File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
packages/react-dom-bindings/src/client Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -1197,8 +1197,14 @@ export function startViewTransition(
1197
1197
// TODO: Wait for fonts.
1198
1198
afterMutationCallback ( ) ;
1199
1199
} ) ;
1200
+ // $FlowFixMe[prop-missing]
1201
+ ownerDocument . __reactViewTransition = transition ;
1200
1202
transition . ready . then ( layoutCallback , layoutCallback ) ;
1201
- transition . finished . then ( passiveCallback ) ;
1203
+ transition . finished . then ( ( ) => {
1204
+ // $FlowFixMe[prop-missing]
1205
+ ownerDocument . __reactViewTransition = null ;
1206
+ passiveCallback ( ) ;
1207
+ } ) ;
1202
1208
return true ;
1203
1209
}
1204
1210
@@ -3681,6 +3687,19 @@ export function suspendOnActiveViewTransition(rootContainer: Container): void {
3681
3687
'Internal React Error: suspendedState null when it was expected to exists. Please report this as a React bug.' ,
3682
3688
) ;
3683
3689
}
3690
+ const state = suspendedState ;
3691
+ const ownerDocument =
3692
+ rootContainer . nodeType === DOCUMENT_NODE
3693
+ ? rootContainer
3694
+ : rootContainer . ownerDocument ;
3695
+ // $FlowFixMe[prop-missing]
3696
+ const activeViewTransition = ownerDocument . __reactViewTransition ;
3697
+ if ( activeViewTransition == null ) {
3698
+ return ;
3699
+ }
3700
+ state . count ++ ;
3701
+ const ping = onUnsuspend . bind ( state ) ;
3702
+ activeViewTransition . finished . then ( ping , ping ) ;
3684
3703
}
3685
3704
3686
3705
export function waitForCommitToBeReady ( ) : null | ( ( ( ) => void ) => ( ) => void ) {
You can’t perform that action at this time.
0 commit comments