@@ -47,7 +47,6 @@ type Props = {
47
47
left ?: null | number ,
48
48
right ?: null | number ,
49
49
top ?: null | number ,
50
- src ?: string ,
51
50
...
52
51
} ;
53
52
type Instance = {
@@ -73,11 +72,6 @@ type CreateRootOptions = {
73
72
...
74
73
} ;
75
74
76
- type SuspenseyCommitSubscription = {
77
- pendingCount : number ,
78
- commit : null | ( ( ) => void ) ,
79
- } ;
80
-
81
75
const NO_CONTEXT = { } ;
82
76
const UPPERCASE_CONTEXT = { } ;
83
77
const UPDATE_SIGNAL = { } ;
@@ -244,11 +238,6 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {
244
238
hidden : ! ! newProps . hidden ,
245
239
context : instance . context ,
246
240
} ;
247
-
248
- if ( type === 'suspensey-thing' && typeof newProps . src === 'string' ) {
249
- clone . src = newProps . src ;
250
- }
251
-
252
241
Object . defineProperty ( clone , 'id' , {
253
242
value : clone . id ,
254
243
enumerable : false ,
@@ -282,78 +271,6 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {
282
271
return hostContext === UPPERCASE_CONTEXT ? rawText . toUpperCase ( ) : rawText ;
283
272
}
284
273
285
- type SuspenseyThingRecord = {
286
- status : 'pending' | 'fulfilled' ,
287
- subscriptions : Array < SuspenseyCommitSubscription > | null ,
288
- } ;
289
-
290
- let suspenseyThingCache : Map <
291
- SuspenseyThingRecord ,
292
- 'pending' | 'fulfilled' ,
293
- > | null = null ;
294
-
295
- // Represents a subscription for all the suspensey things that block a
296
- // particular commit. Once they've all loaded, the commit phase can proceed.
297
- let suspenseyCommitSubscription : SuspenseyCommitSubscription | null = null ;
298
-
299
- function startSuspendingCommit ( ) : void {
300
- // This is where we might suspend on things that aren't associated with a
301
- // particular node, like document.fonts.ready.
302
- suspenseyCommitSubscription = null ;
303
- }
304
-
305
- function suspendInstance ( type : string , props : Props ) : void {
306
- const src = props . src ;
307
- if ( type === 'suspensey-thing' && typeof src === 'string' ) {
308
- // Attach a listener to the suspensey thing and create a subscription
309
- // object that uses reference counting to track when all the suspensey
310
- // things have loaded.
311
- const record = suspenseyThingCache . get ( src ) ;
312
- if ( record === undefined ) {
313
- throw new Error ( 'Could not find record for key.' ) ;
314
- }
315
- if ( record . status === 'pending' ) {
316
- if ( suspenseyCommitSubscription === null ) {
317
- suspenseyCommitSubscription = {
318
- pendingCount : 1 ,
319
- commit : null ,
320
- } ;
321
- } else {
322
- suspenseyCommitSubscription . pendingCount ++ ;
323
- }
324
- }
325
- // Stash the subscription on the record. In `resolveSuspenseyThing`,
326
- // we'll use this fire the commit once all the things have loaded.
327
- if ( record . subscriptions === null ) {
328
- record . subscriptions = [ ] ;
329
- }
330
- record . subscriptions . push ( suspenseyCommitSubscription ) ;
331
- } else {
332
- throw new Error (
333
- 'Did not expect this host component to be visited when suspending ' +
334
- 'the commit. Did you check the SuspendCommit flag?' ,
335
- ) ;
336
- }
337
- return suspenseyCommitSubscription ;
338
- }
339
-
340
- function waitForCommitToBeReady ( ) :
341
- | ( ( commit : ( ) => mixed ) => ( ) => void )
342
- | null {
343
- const subscription = suspenseyCommitSubscription ;
344
- if ( subscription !== null ) {
345
- suspenseyCommitSubscription = null ;
346
- return ( commit : ( ) = > void ) => {
347
- subscription . commit = commit ;
348
- const cancelCommit = ( ) => {
349
- subscription . commit = null ;
350
- } ;
351
- return cancelCommit ;
352
- } ;
353
- }
354
- return null ;
355
- }
356
-
357
274
const sharedHostConfig = {
358
275
supportsSingletons : false ,
359
276
@@ -405,11 +322,6 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {
405
322
hidden : ! ! props . hidden ,
406
323
context : hostContext ,
407
324
} ;
408
-
409
- if ( type === 'suspensey-thing' && typeof props . src === 'string' ) {
410
- inst . src = props . src ;
411
- }
412
-
413
325
// Hide from unit tests
414
326
Object . defineProperty ( inst , 'id' , { value : inst . id , enumerable : false } ) ;
415
327
Object . defineProperty ( inst , 'parent' , {
@@ -568,45 +480,6 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {
568
480
const endTime = Scheduler . unstable_now ( ) ;
569
481
callback ( endTime ) ;
570
482
} ,
571
-
572
- shouldSuspendCommit ( type : string , props : Props ) : boolean {
573
- if ( type === 'suspensey-thing' && typeof props . src === 'string' ) {
574
- if ( suspenseyThingCache === null ) {
575
- suspenseyThingCache = new Map ( ) ;
576
- }
577
- const record = suspenseyThingCache . get ( props . src ) ;
578
- if ( record === undefined ) {
579
- const newRecord : SuspenseyThingRecord = {
580
- status : 'pending' ,
581
- subscriptions : null ,
582
- } ;
583
- suspenseyThingCache . set ( props . src , newRecord ) ;
584
- const onLoadStart = props . onLoadStart ;
585
- if ( typeof onLoadStart === 'function' ) {
586
- onLoadStart ( ) ;
587
- }
588
- return props . src ;
589
- } else {
590
- if ( record . status === 'pending' ) {
591
- // The resource was already requested, but it hasn't finished
592
- // loading yet.
593
- return true ;
594
- } else {
595
- // The resource has already loaded. If the renderer is confident that
596
- // the resource will still be cached by the time the render commits,
597
- // then it can return false, like we do here.
598
- return false ;
599
- }
600
- }
601
- }
602
- // Don't need to suspend.
603
- return false ;
604
- } ,
605
-
606
- startSuspendingCommit ,
607
- suspendInstance ,
608
- waitForCommitToBeReady ,
609
-
610
483
prepareRendererToRender ( ) { } ,
611
484
resetRendererAfterRender ( ) { } ,
612
485
} ;
@@ -635,11 +508,6 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {
635
508
hostUpdateCounter ++ ;
636
509
instance . prop = newProps . prop ;
637
510
instance . hidden = ! ! newProps . hidden ;
638
-
639
- if ( type === 'suspensey-thing' && typeof newProps . src === 'string' ) {
640
- instance . src = newProps . src ;
641
- }
642
-
643
511
if ( shouldSetTextContent ( type , newProps ) ) {
644
512
if ( __DEV__ ) {
645
513
checkPropStringCoercion ( newProps . children , 'children' ) ;
@@ -821,9 +689,6 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {
821
689
if ( instance . hidden ) {
822
690
props . hidden = true ;
823
691
}
824
- if ( instance . src ) {
825
- props . src = instance . src ;
826
- }
827
692
if ( children !== null ) {
828
693
props . children = children ;
829
694
}
@@ -1050,50 +915,6 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {
1050
915
return getPendingChildrenAsJSX ( container ) ;
1051
916
} ,
1052
917
1053
- getSuspenseyThingStatus ( src ) : string | null {
1054
- if ( suspenseyThingCache === null ) {
1055
- return null ;
1056
- } else {
1057
- const record = suspenseyThingCache . get ( src ) ;
1058
- return record === undefined ? null : record . status ;
1059
- }
1060
- } ,
1061
-
1062
- resolveSuspenseyThing ( key : string ) : void {
1063
- if ( suspenseyThingCache === null ) {
1064
- suspenseyThingCache = new Map ( ) ;
1065
- }
1066
- const record = suspenseyThingCache . get ( key ) ;
1067
- if ( record === undefined ) {
1068
- const newRecord : SuspenseyThingRecord = {
1069
- status : 'fulfilled' ,
1070
- subscriptions : null ,
1071
- } ;
1072
- suspenseyThingCache . set ( key , newRecord ) ;
1073
- } else {
1074
- if ( record . status === 'pending' ) {
1075
- record . status = 'fulfilled' ;
1076
- const subscriptions = record . subscriptions ;
1077
- if ( subscriptions !== null ) {
1078
- record . subscriptions = null ;
1079
- for ( let i = 0 ; i < subscriptions . length ; i ++ ) {
1080
- const subscription = subscriptions [ i ] ;
1081
- subscription . pendingCount -- ;
1082
- if ( subscription . pendingCount === 0 ) {
1083
- const commit = subscription . commit ;
1084
- subscription . commit = null ;
1085
- commit ( ) ;
1086
- }
1087
- }
1088
- }
1089
- }
1090
- }
1091
- } ,
1092
-
1093
- resetSuspenseyThingCache ( ) {
1094
- suspenseyThingCache = null ;
1095
- } ,
1096
-
1097
918
createPortal (
1098
919
children : ReactNodeList ,
1099
920
container : Container ,
0 commit comments