MCPcopy Create free account
hub / github.com/reactjs/react-rails / updateContainer

Function updateContainer

lib/assets/react-source/development/react.js:28015–28070  ·  view source on GitHub ↗
(element, container, parentComponent, callback)

Source from the content-addressed store, hash-verified

28013 return createFiberRoot(containerInfo, tag, hydrate);
28014 }
28015 function updateContainer(element, container, parentComponent, callback) {
28016 {
28017 onScheduleRoot(container, element);
28018 }
28019
28020 var current$1 = container.current;
28021 var currentTime = requestCurrentTimeForUpdate();
28022
28023 {
28024 // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
28025 if ('undefined' !== typeof jest) {
28026 warnIfUnmockedScheduler(current$1);
28027 warnIfNotScopedWithMatchingAct(current$1);
28028 }
28029 }
28030
28031 var suspenseConfig = requestCurrentSuspenseConfig();
28032 var expirationTime = computeExpirationForFiber(currentTime, current$1, suspenseConfig);
28033 var context = getContextForSubtree(parentComponent);
28034
28035 if (container.context === null) {
28036 container.context = context;
28037 } else {
28038 container.pendingContext = context;
28039 }
28040
28041 {
28042 if (isRendering && current !== null && !didWarnAboutNestedUpdates) {
28043 didWarnAboutNestedUpdates = true;
28044
28045 error('Render methods should be a pure function of props and state; ' + 'triggering nested component updates from render is not allowed. ' + 'If necessary, trigger nested updates in componentDidUpdate.\n\n' + 'Check the render method of %s.', getComponentName(current.type) || 'Unknown');
28046 }
28047 }
28048
28049 var update = createUpdate(expirationTime, suspenseConfig); // Caution: React DevTools currently depends on this property
28050 // being called "element".
28051
28052 update.payload = {
28053 element: element
28054 };
28055 callback = callback === undefined ? null : callback;
28056
28057 if (callback !== null) {
28058 {
28059 if (typeof callback !== 'function') {
28060 error('render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback);
28061 }
28062 }
28063
28064 update.callback = callback;
28065 }
28066
28067 enqueueUpdate(current$1, update);
28068 scheduleWork(current$1, expirationTime);
28069 return expirationTime;
28070 }
28071 function getPublicRootInstance(container) {
28072 var containerFiber = container.current;

Callers 3

scheduleRootFunction · 0.85
react.jsFile · 0.85

Calls 11

onScheduleRootFunction · 0.85
warnIfUnmockedSchedulerFunction · 0.85
getContextForSubtreeFunction · 0.85
createUpdateFunction · 0.85
enqueueUpdateFunction · 0.85
errorFunction · 0.70
getComponentNameFunction · 0.70

Tested by

no test coverage detected