@@ -90,6 +90,7 @@ export type Capabilities = {
9090 supportsBasicProfiling : boolean ,
9191 hasOwnerMetadata : boolean ,
9292 supportsStrictMode : boolean ,
93+ supportsSuspenseTree : boolean ,
9394 supportsTogglingSuspense : boolean ,
9495 supportsTimeline : boolean ,
9596} ;
@@ -493,6 +494,14 @@ export default class Store extends EventEmitter<{
493494 ) ;
494495 }
495496
497+ supportsSuspenseTree ( rootID : Element [ 'id' ] ) : boolean {
498+ const capabilities = this . _rootIDToCapabilities . get ( rootID ) ;
499+ if ( capabilities === undefined ) {
500+ throw new Error ( `No capabilities registered for root ${ rootID } ` ) ;
501+ }
502+ return capabilities . supportsSuspenseTree ;
503+ }
504+
496505 supportsTogglingSuspense ( rootID : Element [ 'id' ] ) : boolean {
497506 const capabilities = this . _rootIDToCapabilities . get ( rootID ) ;
498507 if ( capabilities === undefined ) {
@@ -895,11 +904,14 @@ export default class Store extends EventEmitter<{
895904 if ( root === null ) {
896905 return [ ] ;
897906 }
898- if ( ! this . supportsTogglingSuspense ( root . id ) ) {
907+ if (
908+ ! this . supportsTogglingSuspense ( rootID ) ||
909+ ! this . supportsSuspenseTree ( rootID )
910+ ) {
899911 return [ ] ;
900912 }
901913 const list : SuspenseNode [ 'id' ] [ ] = [ ] ;
902- const suspense = this . getSuspenseByID ( root . id ) ;
914+ const suspense = this . getSuspenseByID ( rootID ) ;
903915 if ( suspense !== null ) {
904916 const stack = [ suspense ] ;
905917 while ( stack . length > 0 ) {
@@ -1170,6 +1182,7 @@ export default class Store extends EventEmitter<{
11701182 let supportsStrictMode = false ;
11711183 let hasOwnerMetadata = false ;
11721184 let supportsTogglingSuspense = false ;
1185+ let supportsSuspenseTree = false ;
11731186
11741187 // If we don't know the bridge protocol, guess that we're dealing with the latest.
11751188 // If we do know it, we can take it into consideration when parsing operations.
@@ -1185,6 +1198,9 @@ export default class Store extends EventEmitter<{
11851198
11861199 supportsTogglingSuspense = operations [ i ] > 0 ;
11871200 i ++ ;
1201+
1202+ supportsSuspenseTree = operations [ i ] > 0 ;
1203+ i ++ ;
11881204 }
11891205
11901206 this . _roots = this . _roots . concat ( id ) ;
@@ -1193,6 +1209,7 @@ export default class Store extends EventEmitter<{
11931209 supportsBasicProfiling,
11941210 hasOwnerMetadata,
11951211 supportsStrictMode,
1212+ supportsSuspenseTree,
11961213 supportsTogglingSuspense,
11971214 supportsTimeline,
11981215 } ) ;
0 commit comments