( node: RNode, expectedNodeDetails: string | null = null, actualNodeDetails: string | null = null, )
| 361 | } |
| 362 | |
| 363 | export function markRNodeAsHavingHydrationMismatch( |
| 364 | node: RNode, |
| 365 | expectedNodeDetails: string | null = null, |
| 366 | actualNodeDetails: string | null = null, |
| 367 | ) { |
| 368 | if (!ngDevMode) { |
| 369 | throw new Error( |
| 370 | 'Calling `markRNodeAsMismatchedByHydration` in prod mode ' + |
| 371 | 'is not supported and likely a mistake.', |
| 372 | ); |
| 373 | } |
| 374 | |
| 375 | // The RNode can be a standard HTMLElement (not an Angular component or directive) |
| 376 | // The devtools component tree only displays Angular components & directives |
| 377 | // Therefore we attach the debug info to the closest component/directive |
| 378 | while (node && !getComponent(node as Element)) { |
| 379 | node = node?.parentNode as RNode; |
| 380 | } |
| 381 | |
| 382 | if (node) { |
| 383 | patchHydrationInfo(node, { |
| 384 | status: HydrationStatus.Mismatched, |
| 385 | expectedNodeDetails, |
| 386 | actualNodeDetails, |
| 387 | }); |
| 388 | } |
| 389 | } |
| 390 | |
| 391 | export function isRNodeClaimedForHydration(node: RNode): boolean { |
| 392 | return readHydrationInfo(node)?.status === HydrationStatus.Hydrated; |
no test coverage detected
searching dependent graphs…