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

Function mountDehydratedSuspenseComponent

dash/deps/react-dom@18.3.1.js:20648–20677  ·  view source on GitHub ↗
(workInProgress, suspenseInstance, renderLanes)

Source from the content-addressed store, hash-verified

20646 }
20647
20648 function mountDehydratedSuspenseComponent(workInProgress, suspenseInstance, renderLanes) {
20649 // During the first pass, we'll bail out and not drill into the children.
20650 // Instead, we'll leave the content in place and try to hydrate it later.
20651 if ((workInProgress.mode & ConcurrentMode) === NoMode) {
20652 {
20653 error('Cannot hydrate Suspense in legacy mode. Switch from ' + 'ReactDOM.hydrate(element, container) to ' + 'ReactDOMClient.hydrateRoot(container, <App />)' + '.render(element) or remove the Suspense components from ' + 'the server rendered components.');
20654 }
20655
20656 workInProgress.lanes = laneToLanes(SyncLane);
20657 } else if (isSuspenseInstanceFallback(suspenseInstance)) {
20658 // This is a client-only boundary. Since we won't get any content from the server
20659 // for this, we need to schedule that at a higher priority based on when it would
20660 // have timed out. In theory we could render it in this pass but it would have the
20661 // wrong priority associated with it and will prevent hydration of parent path.
20662 // Instead, we'll leave work left on it to render it in a separate commit.
20663 // TODO This time should be the time at which the server rendered response that is
20664 // a parent to this boundary was displayed. However, since we currently don't have
20665 // a protocol to transfer that time, we'll just estimate it by using the current
20666 // time. This will mean that Suspense timeouts are slightly shifted to later than
20667 // they should be.
20668 // Schedule a normal pri update to render this content.
20669 workInProgress.lanes = laneToLanes(DefaultHydrationLane);
20670 } else {
20671 // We'll continue hydrating the rest at offscreen priority since we'll already
20672 // be showing the right content coming from the server, it is no rush.
20673 workInProgress.lanes = laneToLanes(OffscreenLane);
20674 }
20675
20676 return null;
20677 }
20678
20679 function updateDehydratedSuspenseComponent(current, workInProgress, didSuspend, nextProps, suspenseInstance, suspenseState, renderLanes) {
20680 if (!didSuspend) {

Callers 1

updateSuspenseComponentFunction · 0.70

Calls 3

errorFunction · 0.70
laneToLanesFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…