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(
11971197 // TODO: Wait for fonts.
11981198 afterMutationCallback ( ) ;
11991199 } ) ;
1200+ // $FlowFixMe[prop-missing]
1201+ ownerDocument . __reactViewTransition = transition ;
12001202 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+ } ) ;
12021208 return true ;
12031209}
12041210
@@ -3681,6 +3687,19 @@ export function suspendOnActiveViewTransition(rootContainer: Container): void {
36813687 'Internal React Error: suspendedState null when it was expected to exists. Please report this as a React bug.' ,
36823688 ) ;
36833689 }
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 ) ;
36843703}
36853704
36863705export function waitForCommitToBeReady ( ) : null | ( ( ( ) => void ) => ( ) => void ) {
You can’t perform that action at this time.
0 commit comments