From f69f026ac36842cab06392c579de0a1d2968f108 Mon Sep 17 00:00:00 2001 From: forehalo Date: Wed, 14 Aug 2024 03:34:40 +0000 Subject: [PATCH] fix(admin): avoid frequent refetch (#7863) --- packages/frontend/admin/package.json | 1 + packages/frontend/admin/src/app.tsx | 10 +++++++++- yarn.lock | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/frontend/admin/package.json b/packages/frontend/admin/package.json index 9bb73f3f5db0c..ec80218fd496d 100644 --- a/packages/frontend/admin/package.json +++ b/packages/frontend/admin/package.json @@ -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" }, diff --git a/packages/frontend/admin/src/app.tsx b/packages/frontend/admin/src/app.tsx index 38cb50a48a8e9..e9c5652b9c593 100644 --- a/packages/frontend/admin/src/app.tsx +++ b/packages/frontend/admin/src/app.tsx @@ -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'; @@ -108,7 +109,14 @@ export const App = () => { return ( - + + + ); diff --git a/yarn.lock b/yarn.lock index 6a763e07801f7..dd0a3cc8c4271 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"