( request: Request, destination: Destination, boundary: SuspenseBoundary, )
| 5903 | } |
| 5904 | |
| 5905 | function flushPartialBoundary( |
| 5906 | request: Request, |
| 5907 | destination: Destination, |
| 5908 | boundary: SuspenseBoundary, |
| 5909 | ): boolean { |
| 5910 | flushedByteSize = boundary.byteSize; // Start counting bytes |
| 5911 | const completedSegments = boundary.completedSegments; |
| 5912 | let i = 0; |
| 5913 | for (; i < completedSegments.length; i++) { |
| 5914 | const segment = completedSegments[i]; |
| 5915 | if ( |
| 5916 | !flushPartiallyCompletedSegment(request, destination, boundary, segment) |
| 5917 | ) { |
| 5918 | i++; |
| 5919 | completedSegments.splice(0, i); |
| 5920 | // Only write as much as the buffer wants. Something higher priority |
| 5921 | // might want to write later. |
| 5922 | return false; |
| 5923 | } |
| 5924 | } |
| 5925 | completedSegments.splice(0, i); |
| 5926 | |
| 5927 | const row = boundary.row; |
| 5928 | if (row !== null && row.together && boundary.pendingTasks === 1) { |
| 5929 | // "together" rows are blocked on their own boundaries. |
| 5930 | // We have now flushed all the boundary's segments as partials. |
| 5931 | // We can now unblock it from blocking the row that will eventually |
| 5932 | // unblock the boundary itself which can issue its complete instruction. |
| 5933 | // TODO: Ideally the complete instruction would be in a single <script> tag. |
| 5934 | if (row.pendingTasks === 1) { |
| 5935 | unblockSuspenseListRow(request, row, row.hoistables); |
| 5936 | } else { |
| 5937 | row.pendingTasks--; |
| 5938 | } |
| 5939 | } |
| 5940 | |
| 5941 | return writeHoistablesForBoundary( |
| 5942 | destination, |
| 5943 | boundary.contentState, |
| 5944 | request.renderState, |
| 5945 | ); |
| 5946 | } |
| 5947 | |
| 5948 | function flushPartiallyCompletedSegment( |
| 5949 | request: Request, |
no test coverage detected