MCPcopy Create free account
hub / github.com/plotly/dash / legacyCreateRootFromDOMContainer

Function legacyCreateRootFromDOMContainer

dash/deps/react-dom@18.3.1.js:29571–29629  ·  view source on GitHub ↗
(container, initialChildren, parentComponent, callback, isHydrationContainer)

Source from the content-addressed store, hash-verified

29569 }
29570
29571 function legacyCreateRootFromDOMContainer(container, initialChildren, parentComponent, callback, isHydrationContainer) {
29572 if (isHydrationContainer) {
29573 if (typeof callback === 'function') {
29574 var originalCallback = callback;
29575
29576 callback = function () {
29577 var instance = getPublicRootInstance(root);
29578 originalCallback.call(instance);
29579 };
29580 }
29581
29582 var root = createHydrationContainer(initialChildren, callback, container, LegacyRoot, null, // hydrationCallbacks
29583 false, // isStrictMode
29584 false, // concurrentUpdatesByDefaultOverride,
29585 '', // identifierPrefix
29586 noopOnRecoverableError);
29587 container._reactRootContainer = root;
29588 markContainerAsRoot(root.current, container);
29589 var rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container;
29590 listenToAllSupportedEvents(rootContainerElement);
29591 flushSync();
29592 return root;
29593 } else {
29594 // First clear any existing content.
29595 var rootSibling;
29596
29597 while (rootSibling = container.lastChild) {
29598 container.removeChild(rootSibling);
29599 }
29600
29601 if (typeof callback === 'function') {
29602 var _originalCallback = callback;
29603
29604 callback = function () {
29605 var instance = getPublicRootInstance(_root);
29606
29607 _originalCallback.call(instance);
29608 };
29609 }
29610
29611 var _root = createContainer(container, LegacyRoot, null, // hydrationCallbacks
29612 false, // isStrictMode
29613 false, // concurrentUpdatesByDefaultOverride,
29614 '', // identifierPrefix
29615 noopOnRecoverableError);
29616
29617 container._reactRootContainer = _root;
29618 markContainerAsRoot(_root.current, container);
29619
29620 var _rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container;
29621
29622 listenToAllSupportedEvents(_rootContainerElement); // Initial mount should not be batched.
29623
29624 flushSync(function () {
29625 updateContainer(initialChildren, _root, parentComponent, callback);
29626 });
29627 return _root;
29628 }

Callers 1

Calls 8

removeChildMethod · 0.80
getPublicRootInstanceFunction · 0.70
createHydrationContainerFunction · 0.70
markContainerAsRootFunction · 0.70
flushSyncFunction · 0.70
createContainerFunction · 0.70
updateContainerFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…