Skip to content

Commit

Permalink
fix(fe): handle contest problems api error using error boundary (#2243)
Browse files Browse the repository at this point in the history
fix(fe): add error boundary
  • Loading branch information
eunnbi authored Nov 27, 2024
1 parent 209dc61 commit f9aa73f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import KatexContent from '@/components/KatexContent'
import { auth } from '@/libs/auth'
import { fetcherWithAuth } from '@/libs/utils'
import { ErrorBoundary } from '@suspensive/react'
import { Suspense } from 'react'
import {
GoToFirstProblemButton,
Expand Down Expand Up @@ -49,10 +50,11 @@ export default async function ContestTop({ params }: ContestTopProps) {
{session && state !== 'Finished' && (
<div className="mt-10 flex justify-center">
{data.isRegistered ? (
// TODO: add error boundary
<Suspense fallback={<GoToFirstProblemButtonFallback />}>
<GoToFirstProblemButton contestId={Number(contestId)} />
</Suspense>
<ErrorBoundary fallback={null}>
<Suspense fallback={<GoToFirstProblemButtonFallback />}>
<GoToFirstProblemButton contestId={Number(contestId)} />
</Suspense>
</ErrorBoundary>
) : (
<RegisterButton
id={contestId}
Expand Down
1 change: 1 addition & 0 deletions apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"@radix-ui/react-toggle": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.3",
"@sentry/nextjs": "^8.38.0",
"@suspensive/react": "^2.18.7",
"@tailwindcss/typography": "^0.5.15",
"@tanstack/react-query": "^5.59.20",
"@tanstack/react-table": "^8.20.5",
Expand Down
12 changes: 12 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f9aa73f

Please sign in to comment.