Skip to content

Commit c2681eb

Browse files
committed
Follow through all the phases when an error happens during snapshotting
1 parent e5dd82a commit c2681eb

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Diff for: packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -1802,6 +1802,12 @@ export function startViewTransition(
18021802
}
18031803
} finally {
18041804
// Continue the reset of the work.
1805+
// If the error happened in the snapshot phase before the update callback
1806+
// was invoked, then we need to first finish the mutation and layout phases.
1807+
// If they're already invoked it's still safe to call them due the status check.
1808+
mutationCallback();
1809+
layoutCallback();
1810+
// Skip afterMutationCallback() since we're not animating.
18051811
spawnedWorkCallback();
18061812
}
18071813
};
@@ -2137,7 +2143,13 @@ export function startGestureTransition(
21372143
}
21382144
} finally {
21392145
// Continue the reset of the work.
2140-
readyCallback();
2146+
// If the error happened in the snapshot phase before the update callback
2147+
// was invoked, then we need to first finish the mutation and layout phases.
2148+
// If they're already invoked it's still safe to call them due the status check.
2149+
mutationCallback();
2150+
// Skip readyCallback() and go straight to animateCallbck() since we're not animating.
2151+
// animateCallback() is still required to restore states.
2152+
animateCallback();
21412153
}
21422154
};
21432155
transition.ready.then(readyForAnimations, handleError);

0 commit comments

Comments
 (0)