Преглед изворни кода

fix: prevent navigation to 500 page during development (#240)

Only navigate to /500 error page in production environment to avoid
disrupting developer experience during HMR reloads. Toast notification
still shows in both environments for visibility.

Fixes #225
Sat Naing пре 8 месеци
родитељ
комит
eabc3ab92c
1 измењених фајлова са 4 додато и 1 уклоњено
  1. 4 1
      src/main.tsx

+ 4 - 1
src/main.tsx

@@ -59,7 +59,10 @@ const queryClient = new QueryClient({
         }
         if (error.response?.status === 500) {
           toast.error('Internal Server Error!')
-          router.navigate({ to: '/500' })
+          // Only navigate to error page in production to avoid disrupting HMR in development
+          if (import.meta.env.PROD) {
+            router.navigate({ to: '/500' })
+          }
         }
         if (error.response?.status === 403) {
           // router.navigate("/forbidden", { replace: true });