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

Function createSuspenseBoundary

packages/react-server/src/ReactFizzServer.js:795–841  ·  view source on GitHub ↗
(
  request: Request,
  row: null | SuspenseListRow,
  fallbackAbortableTasks: Set<Task>,
  contentPreamble: null | Preamble,
  fallbackPreamble: null | Preamble,
)

Source from the content-addressed store, hash-verified

793}
794
795function createSuspenseBoundary(
796 request: Request,
797 row: null | SuspenseListRow,
798 fallbackAbortableTasks: Set<Task>,
799 contentPreamble: null | Preamble,
800 fallbackPreamble: null | Preamble,
801): SuspenseBoundary {
802 const boundary: SuspenseBoundary = {
803 status: PENDING,
804 rootSegmentID: -1,
805 parentFlushed: false,
806 pendingTasks: 0,
807 row: row,
808 completedSegments: [],
809 byteSize: 0,
810 fallbackAbortableTasks,
811 errorDigest: null,
812 contentState: createHoistableState(),
813 fallbackState: createHoistableState(),
814 contentPreamble,
815 fallbackPreamble,
816 trackedContentKeyPath: null,
817 trackedFallbackNode: null,
818 };
819 if (__DEV__) {
820 // DEV-only fields for hidden class
821 boundary.errorMessage = null;
822 boundary.errorStack = null;
823 boundary.errorComponentStack = null;
824 }
825 if (row !== null) {
826 // This boundary will block this row from completing.
827 row.pendingTasks++;
828 const blockedBoundaries = row.boundaries;
829 if (blockedBoundaries !== null) {
830 // Previous rows will block this boundary itself from completing.
831 request.allPendingTasks++;
832 boundary.pendingTasks++;
833 blockedBoundaries.push(boundary);
834 }
835 const inheritedHoistables = row.inheritedHoistables;
836 if (inheritedHoistables !== null) {
837 hoistHoistables(boundary.contentState, inheritedHoistables);
838 }
839 }
840 return boundary;
841}
842
843function createRenderTask(
844 request: Request,

Callers 3

renderSuspenseBoundaryFunction · 0.85
replaySuspenseBoundaryFunction · 0.85

Calls 3

createHoistableStateFunction · 0.90
hoistHoistablesFunction · 0.90
pushMethod · 0.65

Tested by

no test coverage detected