Skip to content

Commit

Permalink
fix: 머지용 에러바운더리 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
정수현 authored and 정수현 committed Feb 10, 2024
1 parent ba75ff9 commit 60252f6
Showing 1 changed file with 9 additions and 41 deletions.
50 changes: 9 additions & 41 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@ import Layout from '@/components/templates/Layout';
import '@/styles/globals.css';
import type { AppProps } from 'next/app';
import { RecoilRoot } from 'recoil';
import {
QueryClient,
QueryClientProvider,
QueryErrorResetBoundary,
} from '@tanstack/react-query';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import 'dayjs/locale/ko';
import dayjs from 'dayjs';
import { Suspense } from 'react';
import { ErrorBoundary } from 'next/dist/client/components/error-boundary';
dayjs.locale('ko');

const theme = extendTheme({
Expand All @@ -29,43 +23,17 @@ const queryClient = new QueryClient({
},
});

interface ErrorFallbackProps {
error: Error;
resetErrorBoundary: () => void;
}

function ErrorFallback({ error, resetErrorBoundary }: ErrorFallbackProps) {
return (
<div>
Error: {error.message}
<button onClick={resetErrorBoundary}>Retry</button>
</div>
);
}

function LoadingFallback() {
return <div>Loading...</div>;
}

export default function App({ Component, pageProps }: AppProps): JSX.Element {
return (
<QueryClientProvider client={queryClient}>
<QueryErrorResetBoundary>
{({ reset }) => (
<ErrorBoundary onReset={reset} FallbackComponent={ErrorFallback}>
<Suspense fallback={<LoadingFallback />}>
<RecoilRoot>
<ThemeProvider theme={theme}>
<CSSReset />
<Layout>
<Component {...pageProps} />
</Layout>
</ThemeProvider>
</RecoilRoot>
</Suspense>
</ErrorBoundary>
)}
</QueryErrorResetBoundary>
<RecoilRoot>
<ThemeProvider theme={theme}>
<CSSReset />
<Layout>
<Component {...pageProps} />
</Layout>
</ThemeProvider>
</RecoilRoot>
</QueryClientProvider>
);
}

0 comments on commit 60252f6

Please sign in to comment.