Skip to content

Commit f52b574

Browse files
committed
Simplify check for abort error in boundary fallback
1 parent 0e5d221 commit f52b574

3 files changed

Lines changed: 3 additions & 6 deletions

File tree

packages/app/src/ErrorFallback.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { type FallbackProps } from 'react-error-boundary';
22

33
import styles from './App.module.css';
4-
import { AbortError, CANCELLED_BY_USER } from './providers/utils';
4+
import { AbortError } from './providers/utils';
55

66
interface Props extends FallbackProps {
77
className?: string;
@@ -11,7 +11,7 @@ interface Props extends FallbackProps {
1111
function ErrorFallback(props: Props) {
1212
const { className = '', error, resetErrorBoundary } = props;
1313

14-
if (error instanceof AbortError && error.message === CANCELLED_BY_USER) {
14+
if (error instanceof AbortError) {
1515
return (
1616
<p className={`${styles.error} ${className}`}>
1717
Request cancelled

packages/app/src/providers/utils.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ import { type AxiosProgressEvent, isAxiosError } from 'axios';
1919

2020
import { type DataProviderApi } from './api';
2121

22-
export const CANCELLED_BY_USER = 'Cancelled by user';
23-
2422
export function typedArrayFromDType(
2523
dtype: DType,
2624
): TypedArrayConstructor | undefined {

packages/app/src/vis-packs/ValueLoader.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { useTimeoutEffect, useToggle } from '@react-hookz/web';
22
import { useStore } from 'zustand';
33

44
import { useDataContext } from '../providers/DataProvider';
5-
import { CANCELLED_BY_USER } from '../providers/utils';
65
import styles from './ValueLoader.module.css';
76

87
const MAX_PROGRESS_BARS = 3;
@@ -53,7 +52,7 @@ function ValueLoader(props: Props) {
5352
<button
5453
className={styles.cancelBtn}
5554
type="button"
56-
onClick={() => valuesStore.abortAll(CANCELLED_BY_USER)}
55+
onClick={() => valuesStore.abortAll('cancelled by user')}
5756
>
5857
Cancel?
5958
</button>

0 commit comments

Comments
 (0)