MCPcopy
hub / github.com/plotly/dash / legacyCreateRootFromDOMContainer

Function legacyCreateRootFromDOMContainer

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

Source from the content-addressed store, hash-verified

29530 }
29531
29532 function legacyCreateRootFromDOMContainer(container, initialChildren, parentComponent, callback, isHydrationContainer) {
29533 if (isHydrationContainer) {
29534 if (typeof callback === 'function') {
29535 var originalCallback = callback;
29536
29537 callback = function () {
29538 var instance = getPublicRootInstance(root);
29539 originalCallback.call(instance);
29540 };
29541 }
29542
29543 var root = createHydrationContainer(initialChildren, callback, container, LegacyRoot, null, // hydrationCallbacks
29544 false, // isStrictMode
29545 false, // concurrentUpdatesByDefaultOverride,
29546 '', // identifierPrefix
29547 noopOnRecoverableError);
29548 container._reactRootContainer = root;
29549 markContainerAsRoot(root.current, container);
29550 var rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container;
29551 listenToAllSupportedEvents(rootContainerElement);
29552 flushSync();
29553 return root;
29554 } else {
29555 // First clear any existing content.
29556 var rootSibling;
29557
29558 while (rootSibling = container.lastChild) {
29559 container.removeChild(rootSibling);
29560 }
29561
29562 if (typeof callback === 'function') {
29563 var _originalCallback = callback;
29564
29565 callback = function () {
29566 var instance = getPublicRootInstance(_root);
29567
29568 _originalCallback.call(instance);
29569 };
29570 }
29571
29572 var _root = createContainer(container, LegacyRoot, null, // hydrationCallbacks
29573 false, // isStrictMode
29574 false, // concurrentUpdatesByDefaultOverride,
29575 '', // identifierPrefix
29576 noopOnRecoverableError);
29577
29578 container._reactRootContainer = _root;
29579 markContainerAsRoot(_root.current, container);
29580
29581 var _rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container;
29582
29583 listenToAllSupportedEvents(_rootContainerElement); // Initial mount should not be batched.
29584
29585 flushSync(function () {
29586 updateContainer(initialChildren, _root, parentComponent, callback);
29587 });
29588 return _root;
29589 }

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…