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

Function updateContainerImpl

packages/react-reconciler/src/ReactFiberReconciler.js:396–461  ·  view source on GitHub ↗
(
  rootFiber: Fiber,
  lane: Lane,
  element: ReactNodeList,
  container: OpaqueRoot,
  parentComponent: ?component(...props: any),
  callback: ?Function,
)

Source from the content-addressed store, hash-verified

394}
395
396function updateContainerImpl(
397 rootFiber: Fiber,
398 lane: Lane,
399 element: ReactNodeList,
400 container: OpaqueRoot,
401 parentComponent: ?component(...props: any),
402 callback: ?Function,
403): void {
404 if (__DEV__) {
405 onScheduleRoot(container, element);
406 }
407
408 if (enableSchedulingProfiler) {
409 markRenderScheduled(lane);
410 }
411
412 const context = getContextForSubtree(parentComponent);
413 if (container.context === null) {
414 container.context = context;
415 } else {
416 container.pendingContext = context;
417 }
418
419 if (__DEV__) {
420 if (
421 ReactCurrentFiberIsRendering &&
422 ReactCurrentFiberCurrent !== null &&
423 !didWarnAboutNestedUpdates
424 ) {
425 didWarnAboutNestedUpdates = true;
426 console.error(
427 'Render methods should be a pure function of props and state; ' +
428 'triggering nested component updates from render is not allowed. ' +
429 'If necessary, trigger nested updates in componentDidUpdate.\n\n' +
430 'Check the render method of %s.',
431 getComponentNameFromFiber(ReactCurrentFiberCurrent) || 'Unknown',
432 );
433 }
434 }
435
436 const update = createUpdate(lane);
437 // Caution: React DevTools currently depends on this property
438 // being called "element".
439 update.payload = {element};
440
441 callback = callback === undefined ? null : callback;
442 if (callback !== null) {
443 if (__DEV__) {
444 if (typeof callback !== 'function') {
445 console.error(
446 'Expected the last optional `callback` argument to be a ' +
447 'function. Instead received: %s.',
448 callback,
449 );
450 }
451 }
452 update.callback = callback;
453 }

Callers 2

updateContainerFunction · 0.85
updateContainerSyncFunction · 0.85

Calls 10

onScheduleRootFunction · 0.90
markRenderScheduledFunction · 0.90
createUpdateFunction · 0.90
enqueueUpdateFunction · 0.90
startUpdateTimerByLaneFunction · 0.90
scheduleUpdateOnFiberFunction · 0.90
entangleTransitionsFunction · 0.90
getContextForSubtreeFunction · 0.85
errorMethod · 0.65

Tested by

no test coverage detected