@@ -62,7 +62,7 @@ type SuspenseBoundary = {
62
62
pendingTasks : number , // when it reaches zero we can show this boundary's content
63
63
completedSegments : Array < Segment > , // completed but not yet flushed segments.
64
64
byteSize : number , // used to determine whether to inline children boundaries.
65
- fallbackAbortableTask : Set < Task > , // used to cancel task on the fallback if the boundary completes or gets canceled.
65
+ fallbackAbortableTasks : Set < Task > , // used to cancel task on the fallback if the boundary completes or gets canceled.
66
66
} ;
67
67
68
68
type Task = {
@@ -107,8 +107,8 @@ type Request = {
107
107
allPendingTasks : number , // when it reaches zero, we can close the connection.
108
108
pendingRootTasks : number , // when this reaches zero, we've finished at least the root boundary.
109
109
completedRootSegment : null | Segment , // Completed but not yet flushed root segments.
110
- abortableTask : Set < Task > ,
111
- pingedTask : Array < Task > ,
110
+ abortableTasks : Set < Task > ,
111
+ pingedTasks : Array < Task > ,
112
112
// Queues to flush in order of priority
113
113
clientRenderedBoundaries : Array < SuspenseBoundary > , // Errored or client rendered but not yet flushed.
114
114
completedBoundaries : Array < SuspenseBoundary > , // Completed but not yet fully flushed boundaries to show.
@@ -151,7 +151,7 @@ export function createRequest(
151
151
onCompleteAll : ( ) = > void = noop ,
152
152
onReadyToStream : ( ) = > void = noop ,
153
153
) : Request {
154
- const pingedTask = [ ] ;
154
+ const pingedTasks = [ ] ;
155
155
const abortSet : Set < Task > = new Set ( ) ;
156
156
const request = {
157
157
destination,
@@ -162,8 +162,8 @@ export function createRequest(
162
162
allPendingTasks : 0 ,
163
163
pendingRootTasks : 0 ,
164
164
completedRootSegment : null ,
165
- abortableTask : abortSet ,
166
- pingedTask : pingedTask ,
165
+ abortableTasks : abortSet ,
166
+ pingedTasks : pingedTasks ,
167
167
clientRenderedBoundaries : [ ] ,
168
168
completedBoundaries : [ ] ,
169
169
partialBoundaries : [ ] ,
@@ -184,21 +184,21 @@ export function createRequest(
184
184
rootContext ,
185
185
null ,
186
186
) ;
187
- pingedTask . push ( rootTask ) ;
187
+ pingedTasks . push ( rootTask ) ;
188
188
return request ;
189
189
}
190
190
191
191
function pingTask ( request : Request , task : Task ) : void {
192
- const pingedTask = request . pingedTask ;
193
- pingedTask . push ( task ) ;
194
- if ( pingedTask . length === 1 ) {
192
+ const pingedTasks = request . pingedTasks ;
193
+ pingedTasks . push ( task ) ;
194
+ if ( pingedTasks . length === 1 ) {
195
195
scheduleWork ( ( ) => performWork ( request ) ) ;
196
196
}
197
197
}
198
198
199
199
function createSuspenseBoundary (
200
200
request : Request ,
201
- fallbackAbortableTask : Set < Task > ,
201
+ fallbackAbortableTasks : Set < Task > ,
202
202
) : SuspenseBoundary {
203
203
return {
204
204
id : createSuspenseBoundaryID ( request . responseState ) ,
@@ -208,7 +208,7 @@ function createSuspenseBoundary(
208
208
forceClientRender : false ,
209
209
completedSegments : [ ] ,
210
210
byteSize : 0 ,
211
- fallbackAbortableTask ,
211
+ fallbackAbortableTasks ,
212
212
} ;
213
213
}
214
214
@@ -385,7 +385,7 @@ function renderNode(request: Request, task: Task, node: ReactNodeList): void {
385
385
// no parent segment so there's nothing to wait on.
386
386
contentRootSegment . parentFlushed = true ;
387
387
388
- // Currently this is running synchronously. We could instead schedule this to pingedTask .
388
+ // Currently this is running synchronously. We could instead schedule this to pingedTasks .
389
389
// I suspect that there might be some efficiency benefits from not creating the suspended task
390
390
// and instead just using the stack if possible.
391
391
// TODO: Call this directly instead of messing with saving and restoring contexts.
@@ -430,7 +430,7 @@ function renderNode(request: Request, task: Task, node: ReactNodeList): void {
430
430
) ;
431
431
// TODO: This should be queued at a separate lower priority queue so that we only task
432
432
// on preparing fallbacks if we don't have any more main content to task on.
433
- request . pingedTask . push ( suspendedFallbackTask ) ;
433
+ request . pingedTasks . push ( suspendedFallbackTask ) ;
434
434
} else {
435
435
throw new Error ( 'Not yet implemented element type.' ) ;
436
436
}
@@ -501,8 +501,8 @@ function abortTask(task: Task): void {
501
501
502
502
// If this boundary was still pending then we haven't already cancelled its fallbacks.
503
503
// We'll need to abort the fallbacks, which will also error that parent boundary.
504
- boundary . fallbackAbortableTask . forEach ( abortTask , request ) ;
505
- boundary . fallbackAbortableTask . clear ( ) ;
504
+ boundary . fallbackAbortableTasks . forEach ( abortTask , request ) ;
505
+ boundary . fallbackAbortableTasks . clear ( ) ;
506
506
507
507
if ( ! boundary . forceClientRender ) {
508
508
boundary . forceClientRender = true ;
@@ -541,8 +541,8 @@ function finishedTask(
541
541
} else if ( boundary . pendingTasks === 0 ) {
542
542
// This must have been the last segment we were waiting on. This boundary is now complete.
543
543
// We can now cancel any pending task on the fallback since we won't need to show it anymore.
544
- boundary . fallbackAbortableTask . forEach ( abortTaskSoft , request ) ;
545
- boundary . fallbackAbortableTask . clear ( ) ;
544
+ boundary . fallbackAbortableTasks . forEach ( abortTaskSoft , request ) ;
545
+ boundary . fallbackAbortableTasks . clear ( ) ;
546
546
if ( segment . parentFlushed ) {
547
547
// Our parent segment already flushed, so we need to schedule this segment to be emitted.
548
548
boundary . completedSegments . push ( segment ) ;
@@ -625,13 +625,13 @@ function performWork(request: Request): void {
625
625
ReactCurrentDispatcher . current = Dispatcher ;
626
626
627
627
try {
628
- const pingedTask = request . pingedTask ;
628
+ const pingedTasks = request . pingedTasks ;
629
629
let i ;
630
- for ( i = 0 ; i < pingedTask . length ; i ++ ) {
631
- const task = pingedTask [ i ] ;
630
+ for ( i = 0 ; i < pingedTasks . length ; i ++ ) {
631
+ const task = pingedTasks [ i ] ;
632
632
retryTask ( request , task ) ;
633
633
}
634
- pingedTask . splice ( 0 , i ) ;
634
+ pingedTasks . splice ( 0 , i ) ;
635
635
if ( request . status === FLOWING ) {
636
636
flushCompletedQueues ( request ) ;
637
637
}
@@ -953,14 +953,14 @@ function flushCompletedQueues(request: Request): void {
953
953
flushBuffered ( destination ) ;
954
954
if (
955
955
request . allPendingTasks === 0 &&
956
- request . pingedTask . length === 0 &&
956
+ request . pingedTasks . length === 0 &&
957
957
request . clientRenderedBoundaries . length === 0 &&
958
958
request . completedBoundaries . length === 0
959
959
// We don't need to check any partially completed segments because
960
960
// either they have pending task or they're complete.
961
961
) {
962
962
if ( __DEV__ ) {
963
- if ( request . abortableTask . size !== 0 ) {
963
+ if ( request . abortableTasks . size !== 0 ) {
964
964
console . error (
965
965
'There was still abortable task at the root when we closed. This is a bug in React.' ,
966
966
) ;
@@ -992,9 +992,9 @@ export function startFlowing(request: Request): void {
992
992
// This is called to early terminate a request. It puts all pending boundaries in client rendered state.
993
993
export function abort ( request : Request ) : void {
994
994
try {
995
- const abortableTask = request . abortableTask ;
996
- abortableTask . forEach ( abortTask , request ) ;
997
- abortableTask . clear ( ) ;
995
+ const abortableTasks = request . abortableTasks ;
996
+ abortableTasks . forEach ( abortTask , request ) ;
997
+ abortableTasks . clear ( ) ;
998
998
if ( request . status === FLOWING ) {
999
999
flushCompletedQueues ( request ) ;
1000
1000
}
0 commit comments