( request: Request, destination: Destination, boundary: SuspenseBoundary, segment: Segment, )
| 5946 | } |
| 5947 | |
| 5948 | function flushPartiallyCompletedSegment( |
| 5949 | request: Request, |
| 5950 | destination: Destination, |
| 5951 | boundary: SuspenseBoundary, |
| 5952 | segment: Segment, |
| 5953 | ): boolean { |
| 5954 | if (segment.status === FLUSHED) { |
| 5955 | // We've already flushed this inline. |
| 5956 | return true; |
| 5957 | } |
| 5958 | |
| 5959 | const hoistableState = boundary.contentState; |
| 5960 | |
| 5961 | const segmentID = segment.id; |
| 5962 | if (segmentID === -1) { |
| 5963 | // This segment wasn't previously referred to. This happens at the root of |
| 5964 | // a boundary. We make kind of a leap here and assume this is the root. |
| 5965 | const rootSegmentID = (segment.id = boundary.rootSegmentID); |
| 5966 | |
| 5967 | if (rootSegmentID === -1) { |
| 5968 | throw new Error( |
| 5969 | 'A root segment ID must have been assigned by now. This is a bug in React.', |
| 5970 | ); |
| 5971 | } |
| 5972 | |
| 5973 | return flushSegmentContainer(request, destination, segment, hoistableState); |
| 5974 | } else if (segmentID === boundary.rootSegmentID) { |
| 5975 | // When we emit postponed boundaries, we might have assigned the ID already |
| 5976 | // but it's still the root segment so we can't inject it into the parent yet. |
| 5977 | return flushSegmentContainer(request, destination, segment, hoistableState); |
| 5978 | } else { |
| 5979 | flushSegmentContainer(request, destination, segment, hoistableState); |
| 5980 | return writeCompletedSegmentInstruction( |
| 5981 | destination, |
| 5982 | request.resumableState, |
| 5983 | request.renderState, |
| 5984 | segmentID, |
| 5985 | ); |
| 5986 | } |
| 5987 | } |
| 5988 | |
| 5989 | let flushingPartialBoundaries = false; |
| 5990 |
no test coverage detected