From 28ad5c09ad5acbeb21be00004c584566aad60b8e Mon Sep 17 00:00:00 2001 From: CCS Admin Date: Thu, 26 Feb 2026 18:18:37 +0000 Subject: [PATCH] feat: add TanStack Query with QueryClientProvider Install @tanstack/react-query v5 and wrap the app with QueryClientProvider as foundation for server-state management. Co-Authored-By: Claude Opus 4.6 --- frontend/package.json | 1 + frontend/pnpm-lock.yaml | 18 +++++++++++++ frontend/src/App.tsx | 57 +++++++++++++++++++++++++---------------- 3 files changed, 54 insertions(+), 22 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index 4d6ad42..2cc0989 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -11,6 +11,7 @@ }, "dependencies": { "@hookform/resolvers": "^5.2.2", + "@tanstack/react-query": "^5.90.21", "axios": "^1.13.5", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index 217962c..3668f86 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -11,6 +11,9 @@ importers: '@hookform/resolvers': specifier: ^5.2.2 version: 5.2.2(react-hook-form@7.71.2(react@19.2.4)) + '@tanstack/react-query': + specifier: ^5.90.21 + version: 5.90.21(react@19.2.4) axios: specifier: ^1.13.5 version: 1.13.5 @@ -1520,6 +1523,14 @@ packages: peerDependencies: vite: ^5.2.0 || ^6 || ^7 + '@tanstack/query-core@5.90.20': + resolution: {integrity: sha512-OMD2HLpNouXEfZJWcKeVKUgQ5n+n3A2JFmBaScpNDUqSrQSjiveC7dKMe53uJUg1nDG16ttFPz2xfilz6i2uVg==} + + '@tanstack/react-query@5.90.21': + resolution: {integrity: sha512-0Lu6y5t+tvlTJMTO7oh5NSpJfpg/5D41LlThfepTixPYkJ0sE2Jj0m0f6yYqujBwIXlId87e234+MxG3D3g7kg==} + peerDependencies: + react: ^18 || ^19 + '@ts-morph/common@0.27.0': resolution: {integrity: sha512-Wf29UqxWDpc+i61k3oIOzcUfQt79PIT9y/MWfAGlrkjg6lBC1hwDECLXPVJAhWjiGbfBCxZd65F/LIZF3+jeJQ==} @@ -4854,6 +4865,13 @@ snapshots: tailwindcss: 4.2.1 vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(lightningcss@1.31.1) + '@tanstack/query-core@5.90.20': {} + + '@tanstack/react-query@5.90.21(react@19.2.4)': + dependencies: + '@tanstack/query-core': 5.90.20 + react: 19.2.4 + '@ts-morph/common@0.27.0': dependencies: fast-glob: 3.3.3 diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 1c44285..9bc4ae5 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1,3 +1,4 @@ +import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom' import { AuthProvider } from '@/context/AuthContext' import { ProtectedRoute } from '@/components/layout/ProtectedRoute' @@ -16,30 +17,42 @@ import { AdminAuditPage } from '@/pages/AdminAuditPage' import { DisclosuresPage } from '@/pages/DisclosuresPage' import { AccountPage } from '@/pages/AccountPage' +const queryClient = new QueryClient({ + defaultOptions: { + queries: { + staleTime: 30_000, + retry: 1, + refetchOnWindowFocus: false, + }, + }, +}) + function App() { return ( - - - - } /> - } /> - }> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - - - - + + + + + } /> + } /> + }> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + + + + + ) }