Skip to content

Commit 75c9798

Browse files
authored
Ignore AbortError for gestures (facebook#32579)
Follow up to facebook#32540. We do allow gestures to be cancelled early (we call skipTransition) if the gesture stops before it has even started. This happens in the fixture when we auto-scroll.
1 parent 6aa8254 commit 75c9798

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,7 +1577,10 @@ function cancelAllViewTransitionAnimations(scope: Element) {
15771577
// either cached the font or preloaded it earlier.
15781578
const SUSPENSEY_FONT_TIMEOUT = 500;
15791579

1580-
function customizeViewTransitionError(error: Object): mixed {
1580+
function customizeViewTransitionError(
1581+
error: Object,
1582+
ignoreAbort: boolean,
1583+
): mixed {
15811584
if (typeof error === 'object' && error !== null) {
15821585
switch (error.name) {
15831586
case 'TimeoutError': {
@@ -1596,6 +1599,9 @@ function customizeViewTransitionError(error: Object): mixed {
15961599
break;
15971600
}
15981601
case 'AbortError': {
1602+
if (ignoreAbort) {
1603+
return null;
1604+
}
15991605
if (__DEV__) {
16001606
// eslint-disable-next-line react-internal/prod-error-codes
16011607
return new Error(
@@ -1708,7 +1714,7 @@ export function startViewTransition(
17081714
ownerDocument.__reactViewTransition = transition;
17091715
const handleError = (error: mixed) => {
17101716
try {
1711-
error = customizeViewTransitionError(error);
1717+
error = customizeViewTransitionError(error, false);
17121718
if (error !== null) {
17131719
errorCallback(error);
17141720
}
@@ -1998,7 +2004,7 @@ export function startGestureTransition(
19982004
: readyCallback;
19992005
const handleError = (error: mixed) => {
20002006
try {
2001-
error = customizeViewTransitionError(error);
2007+
error = customizeViewTransitionError(error, true);
20022008
if (error !== null) {
20032009
errorCallback(error);
20042010
}

0 commit comments

Comments
 (0)