@samitouri / QOS-React / commits / 75c979847f

Ignore AbortError for gestures (#32579)

Follow up to #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.

Sebastian Markbåge committed Mar 12, 2025 at 14:20 UTC 75c979847f1c6dd954860f17b4dc181ad7c2891e
1 file changed +9 -3
packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js
+9 -3
@@ -1577,7 +1577,10 @@ function cancelAllViewTransitionAnimations(scope: Element) {
1577 // either cached the font or preloaded it earlier.
1578 const SUSPENSEY_FONT_TIMEOUT = 500;
1579
1580 -function customizeViewTransitionError(error: Object): mixed {
1580 +function customizeViewTransitionError(
1581 + error: Object,
1582 + ignoreAbort: boolean,
1583 +): mixed {
1584 if (typeof error === 'object' && error !== null) {
1585 switch (error.name) {
1586 case 'TimeoutError': {
@@ -1596,6 +1599,9 @@ function customizeViewTransitionError(error: Object): mixed {
1599 break;
1600 }
1601 case 'AbortError': {
1602 + if (ignoreAbort) {
1603 + return null;
1604 + }
1605 if (__DEV__) {
1606 // eslint-disable-next-line react-internal/prod-error-codes
1607 return new Error(
@@ -1708,7 +1714,7 @@ export function startViewTransition(
1714 ownerDocument.__reactViewTransition = transition;
1715 const handleError = (error: mixed) => {
1716 try {
1711 - error = customizeViewTransitionError(error);
1717 + error = customizeViewTransitionError(error, false);
1718 if (error !== null) {
1719 errorCallback(error);
1720 }
@@ -1998,7 +2004,7 @@ export function startGestureTransition(
2004 : readyCallback;
2005 const handleError = (error: mixed) => {
2006 try {
2001 - error = customizeViewTransitionError(error);
2007 + error = customizeViewTransitionError(error, true);
2008 if (error !== null) {
2009 errorCallback(error);
2010 }