Skip to content

Commit

Permalink
fix(admin): avoid frequent refetch (#7863)
Browse files Browse the repository at this point in the history
  • Loading branch information
forehalo committed Aug 14, 2024
1 parent 0152473 commit f69f026
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/frontend/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"react-resizable-panels": "^2.0.19",
"react-router-dom": "^6.23.1",
"sonner": "^1.5.0",
"swr": "^2.2.5",
"vaul": "^0.9.1",
"zod": "^3.23.8"
},
Expand Down
10 changes: 9 additions & 1 deletion packages/frontend/admin/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
useLocation,
} from 'react-router-dom';
import { toast } from 'sonner';
import { SWRConfig } from 'swr';

import { TooltipProvider } from './components/ui/tooltip';
import { isAdmin, useCurrentUser, useServerConfig } from './modules/common';
Expand Down Expand Up @@ -108,7 +109,14 @@ export const App = () => {
return (
<TooltipProvider>
<Telemetry />
<RouterProvider router={router} />
<SWRConfig
value={{
revalidateOnFocus: false,
revalidateOnMount: false,
}}
>
<RouterProvider router={router} />
</SWRConfig>
<Toaster />
</TooltipProvider>
);
Expand Down
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ __metadata:
react-router-dom: "npm:^6.23.1"
shadcn-ui: "npm:^0.8.0"
sonner: "npm:^1.5.0"
swr: "npm:^2.2.5"
tailwind-merge: "npm:^2.3.0"
tailwindcss: "npm:^3.4.4"
tailwindcss-animate: "npm:^1.0.7"
Expand Down

0 comments on commit f69f026

Please sign in to comment.