MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / legacyRenderSubtreeIntoContainer

Function legacyRenderSubtreeIntoContainer

code/styling/public/app.js:17825–17870  ·  view source on GitHub ↗
(parentComponent, children, container, forceHydrate, callback)

Source from the content-addressed store, hash-verified

17823}
17824
17825function legacyRenderSubtreeIntoContainer(parentComponent, children, container, forceHydrate, callback) {
17826 // TODO: Ensure all entry points contain this check
17827 !isValidContainer(container) ? invariant(false, 'Target container is not a DOM element.') : void 0;
17828
17829 {
17830 topLevelUpdateWarnings(container);
17831 }
17832
17833 // TODO: Without `any` type, Flow says "Property cannot be accessed on any
17834 // member of intersection type." Whyyyyyy.
17835 var root = container._reactRootContainer;
17836 if (!root) {
17837 // Initial mount
17838 root = container._reactRootContainer = legacyCreateRootFromDOMContainer(container, forceHydrate);
17839 if (typeof callback === 'function') {
17840 var originalCallback = callback;
17841 callback = function () {
17842 var instance = DOMRenderer.getPublicRootInstance(root._internalRoot);
17843 originalCallback.call(instance);
17844 };
17845 }
17846 // Initial mount should not be batched.
17847 DOMRenderer.unbatchedUpdates(function () {
17848 if (parentComponent != null) {
17849 root.legacy_renderSubtreeIntoContainer(parentComponent, children, callback);
17850 } else {
17851 root.render(children, callback);
17852 }
17853 });
17854 } else {
17855 if (typeof callback === 'function') {
17856 var _originalCallback = callback;
17857 callback = function () {
17858 var instance = DOMRenderer.getPublicRootInstance(root._internalRoot);
17859 _originalCallback.call(instance);
17860 };
17861 }
17862 // Update
17863 if (parentComponent != null) {
17864 root.legacy_renderSubtreeIntoContainer(parentComponent, children, callback);
17865 } else {
17866 root.render(children, callback);
17867 }
17868 }
17869 return DOMRenderer.getPublicRootInstance(root._internalRoot);
17870}
17871
17872function createPortal(children, container) {
17873 var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;

Callers 1

app.jsFile · 0.70

Calls 4

isValidContainerFunction · 0.70
invariantFunction · 0.70
renderMethod · 0.45

Tested by

no test coverage detected