MCPcopy
hub / github.com/facebook/react / commitHook

Function commitHook

packages/react-reconciler/src/ReactTestSelectors.js:578–592  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

576
577 // When React mutates the host environment, we may need to change what we're listening to.
578 const commitHook = () => {
579 const nextInstanceRoots = findAllNodes(hostRoot, selectors);
580
581 instanceRoots.forEach(target => {
582 if (nextInstanceRoots.indexOf(target) < 0) {
583 unobserve(target);
584 }
585 });
586
587 nextInstanceRoots.forEach(target => {
588 if (instanceRoots.indexOf(target) < 0) {
589 observe(target);
590 }
591 });
592 };
593
594 commitHooks.push(commitHook);
595

Callers 1

onCommitRootFunction · 0.85

Calls 2

findAllNodesFunction · 0.85
forEachMethod · 0.65

Tested by

no test coverage detected