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

Function shouldCaptureSuspense

lib/assets/react-source/development/react.js:18207–18240  ·  view source on GitHub ↗
(workInProgress, hasInvisibleParent)

Source from the content-addressed store, hash-verified

18205 }
18206
18207 function shouldCaptureSuspense(workInProgress, hasInvisibleParent) {
18208 // If it was the primary children that just suspended, capture and render the
18209 // fallback. Otherwise, don't capture and bubble to the next boundary.
18210 var nextState = workInProgress.memoizedState;
18211
18212 if (nextState !== null) {
18213 if (nextState.dehydrated !== null) {
18214 // A dehydrated boundary always captures.
18215 return true;
18216 }
18217
18218 return false;
18219 }
18220
18221 var props = workInProgress.memoizedProps; // In order to capture, the Suspense component must have a fallback prop.
18222
18223 if (props.fallback === undefined) {
18224 return false;
18225 } // Regular boundaries always capture.
18226
18227
18228 if (props.unstable_avoidThisFallback !== true) {
18229 return true;
18230 } // If it's a boundary we should avoid, then we prefer to bubble up to the
18231 // parent boundary if it is currently invisible.
18232
18233
18234 if (hasInvisibleParent) {
18235 return false;
18236 } // If the parent is not able to handle it, we must handle it.
18237
18238
18239 return true;
18240 }
18241 function findFirstSuspended(row) {
18242 var node = row;
18243

Callers 1

throwExceptionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected