MCPcopy Create free account
hub / github.com/microsoft/SandDance / shouldCaptureSuspense

Function shouldCaptureSuspense

docs/external/js/react-dom.development.js:14647–14680  ·  view source on GitHub ↗
(workInProgress, hasInvisibleParent)

Source from the content-addressed store, hash-verified

14645 }
14646
14647 function shouldCaptureSuspense(workInProgress, hasInvisibleParent) {
14648 // If it was the primary children that just suspended, capture and render the
14649 // fallback. Otherwise, don't capture and bubble to the next boundary.
14650 var nextState = workInProgress.memoizedState;
14651
14652 if (nextState !== null) {
14653 if (nextState.dehydrated !== null) {
14654 // A dehydrated boundary always captures.
14655 return true;
14656 }
14657
14658 return false;
14659 }
14660
14661 var props = workInProgress.memoizedProps; // In order to capture, the Suspense component must have a fallback prop.
14662
14663 if (props.fallback === undefined) {
14664 return false;
14665 } // Regular boundaries always capture.
14666
14667
14668 if (props.unstable_avoidThisFallback !== true) {
14669 return true;
14670 } // If it's a boundary we should avoid, then we prefer to bubble up to the
14671 // parent boundary if it is currently invisible.
14672
14673
14674 if (hasInvisibleParent) {
14675 return false;
14676 } // If the parent is not able to handle it, we must handle it.
14677
14678
14679 return true;
14680 }
14681 function findFirstSuspended(row) {
14682 var node = row;
14683

Callers 1

throwExceptionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected