File tree Expand file tree Collapse file tree
packages/core/src/runtime Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3798,6 +3798,29 @@ describe("initSandboxRuntimeModular", () => {
37983798 expect ( window . __renderReady ) . toBe ( true ) ;
37993799 } ) ;
38003800
3801+ it ( "a torn-down runtime's pending readiness check leaves the next document alone" , ( ) => {
3802+ vi . useFakeTimers ( ) ;
3803+ try {
3804+ const root = document . createElement ( "div" ) ;
3805+ root . setAttribute ( "data-composition-id" , "main" ) ;
3806+ root . setAttribute ( "data-root" , "true" ) ;
3807+ root . setAttribute ( "data-start" , "0" ) ;
3808+ document . body . appendChild ( root ) ;
3809+ window . __timelines = { main : createMockTimeline ( 10 ) } ;
3810+
3811+ initSandboxRuntimeModular ( ) ;
3812+ window . __hfRuntimeTeardown ?.( ) ;
3813+ // The next document is still batching its timelines when the old check fires.
3814+ delete window . __renderReady ;
3815+ window . __hfTimelinesBuilding = true ;
3816+ vi . runAllTimers ( ) ;
3817+
3818+ expect ( window . __renderReady ) . toBeUndefined ( ) ;
3819+ } finally {
3820+ vi . useRealTimers ( ) ;
3821+ }
3822+ } ) ;
3823+
38013824 it ( "sets __renderReady even without a GSAP timeline (CSS/WAAPI compositions)" , ( ) => {
38023825 const root = document . createElement ( "div" ) ;
38033826 root . setAttribute ( "data-composition-id" , "main" ) ;
Original file line number Diff line number Diff line change @@ -4114,6 +4114,7 @@ export function initSandboxRuntimeModular(): void {
41144114 } ) ;
41154115
41164116 maybePublishRenderReady = ( ) => {
4117+ if ( state . tornDown ) return ;
41174118 if ( ! externalCompositionsReady ) {
41184119 window . __renderReady = false ;
41194120 return ;
You can’t perform that action at this time.
0 commit comments