Skip to content

Commit

Permalink
fix(fe): resolve 504 timeout error in vercel (#1251)
Browse files Browse the repository at this point in the history
* chore: remove header from main layout

* feat: remove api call from main page

* feat: add header again

* feat: try api call with timeout 3s

* feat: log response time

* feat: use node-fetch

* feat: log fetching timing

* feat: use axios

* feat: disable standalone output

* feat: use nextjs fetch

* feat: use suspense component

* feat: add problem cards

* fix: remove unused component

* feat: use skeleton while waiting for API response

* feat: set API fetch timeout to 5 seconds

* fix: do not show zero time diff

* feat: add error page for timeout

* feat: add loading fallback in notice page

* feat: add loading fallback in problem list page

* fix: ignore timediff hydration warning

* feat: adjust error message width

* feat: add loading fallback in contest page

* fix: resolve build error

* feat(ci): disable linting on nexjts build

* fix(ci): do not perform typecheck for frontend-client

Check: vercel/next.js#53959

* feat(fe): remove images.dt.s

---------

Co-authored-by: Dayong Lee <dayongkr@gmail.com>
  • Loading branch information
2 people authored and cho-to committed Feb 5, 2024
1 parent 60dd1ca commit 4469968
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Skeleton from '@/components/ui/skeleton'
import { Skeleton } from '@/components/ui/skeleton'

export default function DescriptionLoading() {
return (
Expand Down
6 changes: 4 additions & 2 deletions frontend-client/components/ui/skeleton.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { cn } from '@/lib/utils'

export default function Skeleton({
const Skeleton = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) {
}: React.HTMLAttributes<HTMLDivElement>) => {
return (
<div
className={cn(
Expand All @@ -14,3 +14,5 @@ export default function Skeleton({
/>
)
}

export { Skeleton }
11 changes: 11 additions & 0 deletions frontend-client/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ export const fetcher = ky.create({
prefixUrl: baseUrl,
throwHttpErrors: false,
retry: 0,
timeout: 5000,
hooks: {
beforeError: [
(error) => {
if (error instanceof TimeoutError) {
toast.error('Request timed out. Please try again later.')
}
return error
}
]
},
next: {
revalidate: 10 // 10 seconds
}
Expand Down

0 comments on commit 4469968

Please sign in to comment.