MCPcopy Index your code
hub / github.com/angular/angular / markRNodeAsHavingHydrationMismatch

Function markRNodeAsHavingHydrationMismatch

packages/core/src/hydration/utils.ts:363–389  ·  view source on GitHub ↗
(
  node: RNode,
  expectedNodeDetails: string | null = null,
  actualNodeDetails: string | null = null,
)

Source from the content-addressed store, hash-verified

361}
362
363export 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
391export function isRNodeClaimedForHydration(node: RNode): boolean {
392 return readHydrationInfo(node)?.status === HydrationStatus.Hydrated;

Callers 4

validateMatchingNodeFunction · 0.90
validateNodeExistsFunction · 0.90
nodeNotFoundAtPathErrorFunction · 0.90

Calls 2

getComponentFunction · 0.90
patchHydrationInfoFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…