(request: Request)
| 6170 | } |
| 6171 | |
| 6172 | export function startWork(request: Request): void { |
| 6173 | request.flushScheduled = request.destination !== null; |
| 6174 | // When prerendering we use microtasks for pinging work |
| 6175 | if (supportsRequestStorage) { |
| 6176 | scheduleMicrotask(() => requestStorage.run(request, performWork, request)); |
| 6177 | } else { |
| 6178 | scheduleMicrotask(() => performWork(request)); |
| 6179 | } |
| 6180 | scheduleWork(() => { |
| 6181 | if (request.status === OPENING) { |
| 6182 | request.status = OPEN; |
| 6183 | } |
| 6184 | |
| 6185 | if (request.trackedPostpones === null) { |
| 6186 | // this is either a regular render or a resume. For regular render we want |
| 6187 | // to call emitEarlyPreloads after the first performWork because we want |
| 6188 | // are responding to a live request and need to balance sending something early |
| 6189 | // (i.e. don't want for the shell to finish) but we need something to send. |
| 6190 | // The only implementation of this is for DOM at the moment and during resumes nothing |
| 6191 | // actually emits but the code paths here are the same. |
| 6192 | // During a prerender we don't want to be too aggressive in emitting early preloads |
| 6193 | // because we aren't responding to a live request and we can wait for the prerender to |
| 6194 | // postpone before we emit anything. |
| 6195 | if (supportsRequestStorage) { |
| 6196 | requestStorage.run( |
| 6197 | request, |
| 6198 | enqueueEarlyPreloadsAfterInitialWork, |
| 6199 | request, |
| 6200 | ); |
| 6201 | } else { |
| 6202 | enqueueEarlyPreloadsAfterInitialWork(request); |
| 6203 | } |
| 6204 | } |
| 6205 | }); |
| 6206 | } |
| 6207 | |
| 6208 | function enqueueEarlyPreloadsAfterInitialWork(request: Request) { |
| 6209 | const shellComplete = request.pendingRootTasks === 0; |
no test coverage detected