mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
Follow through all the phases when an error happens during snapshotting (#32803)
This can happen for example if you have duplicate names in the "old" state. This errors the transition before the updateCallback is invoked so we haven't yet applied mutations etc. This runs through those phases after the error to get us back to a consistent state.
This commit is contained in:
parent
450f8df886
commit
040f8286e9
|
|
@ -1802,6 +1802,12 @@ export function startViewTransition(
|
|||
}
|
||||
} finally {
|
||||
// Continue the reset of the work.
|
||||
// If the error happened in the snapshot phase before the update callback
|
||||
// was invoked, then we need to first finish the mutation and layout phases.
|
||||
// If they're already invoked it's still safe to call them due the status check.
|
||||
mutationCallback();
|
||||
layoutCallback();
|
||||
// Skip afterMutationCallback() since we're not animating.
|
||||
spawnedWorkCallback();
|
||||
}
|
||||
};
|
||||
|
|
@ -2137,7 +2143,13 @@ export function startGestureTransition(
|
|||
}
|
||||
} finally {
|
||||
// Continue the reset of the work.
|
||||
readyCallback();
|
||||
// If the error happened in the snapshot phase before the update callback
|
||||
// was invoked, then we need to first finish the mutation and layout phases.
|
||||
// If they're already invoked it's still safe to call them due the status check.
|
||||
mutationCallback();
|
||||
// Skip readyCallback() and go straight to animateCallbck() since we're not animating.
|
||||
// animateCallback() is still required to restore states.
|
||||
animateCallback();
|
||||
}
|
||||
};
|
||||
transition.ready.then(readyForAnimations, handleError);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user