Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

feat(frontend): Add React Query DevTools and ESLint Rules (#10194)

Abhimanyu Yadava541a3edd75e
diff --git a/autogpt_platform/frontend/.env.example b/autogpt_platform/frontend/.env.example
index e3763c1da0..2760ee361a 100644
--- a/autogpt_platform/frontend/.env.example
+++ b/autogpt_platform/frontend/.env.example
@@ -33,3 +33,6 @@ NEXT_PUBLIC_SHOW_BILLING_PAGE=false
## This is the frontend site key
NEXT_PUBLIC_CLOUDFLARE_TURNSTILE_SITE_KEY=
NEXT_PUBLIC_TURNSTILE=disabled
+
+# Devtools
+NEXT_PUBLIC_REACT_QUERY_DEVTOOL=true
\ No newline at end of file
diff --git a/autogpt_platform/frontend/.eslintrc.json b/autogpt_platform/frontend/.eslintrc.json
index f5bc19d00b..04a3f05d0f 100644
--- a/autogpt_platform/frontend/.eslintrc.json
+++ b/autogpt_platform/frontend/.eslintrc.json
@@ -2,7 +2,8 @@
"extends": [
"next/core-web-vitals",
"next/typescript",
- "plugin:storybook/recommended"
+ "plugin:storybook/recommended",
+ "plugin:@tanstack/query/recommended"
],
"rules": {
// Disabling exhaustive-deps to avoid forcing unnecessary dependencies and useCallback proliferation.
diff --git a/autogpt_platform/frontend/README.md b/autogpt_platform/frontend/README.md
index ee9dc60df8..18fda747d4 100644
--- a/autogpt_platform/frontend/README.md
+++ b/autogpt_platform/frontend/README.md
@@ -156,3 +156,9 @@ By integrating Storybook into our development workflow, we can streamline UI dev
- [**Zod**](https://zod.dev/) - TypeScript-first schema validation
- [**React Table**](https://tanstack.com/table) - Headless table library
- [**React Flow**](https://reactflow.dev/) - Interactive node-based diagrams
+- [**React Query**](https://tanstack.com/query/latest/docs/framework/react/overview) - Data fetching and caching
+- [**React Query DevTools**](https://tanstack.com/query/latest/docs/framework/react/devtools) - Debugging tool for React Query
+
+### Development Tools
+
+- `NEXT_PUBLIC_REACT_QUERY_DEVTOOL` - Enable React Query DevTools. Set to `true` to enable.
diff --git a/autogpt_platform/frontend/package.json b/autogpt_platform/frontend/package.json
index d55815ff37..db99a8eecc 100644
--- a/autogpt_platform/frontend/package.json
+++ b/autogpt_platform/frontend/package.json
@@ -98,6 +98,8 @@
"@storybook/addon-links": "9.0.12",
"@storybook/addon-onboarding": "9.0.12",
"@storybook/nextjs": "9.0.12",
+ "@tanstack/eslint-plugin-query": "5.78.0",
+ "@tanstack/react-query-devtools": "5.80.10",
"@types/canvas-confetti": "1.9.0",
"@types/lodash": "4.17.18",
"@types/negotiator": "0.6.4",
diff --git a/autogpt_platform/frontend/pnpm-lock.yaml b/autogpt_platform/frontend/pnpm-lock.yaml
index 002ac43d91..25de706c3f 100644
--- a/autogpt_platform/frontend/pnpm-lock.yaml
+++ b/autogpt_platform/frontend/pnpm-lock.yaml
@@ -225,6 +225,12 @@ importers:
'@storybook/nextjs':
specifier: 9.0.12
+ '@tanstack/eslint-plugin-query':
+ specifier: 5.78.0
+ '@tanstack/react-query-devtools':
+ specifier: 5.80.10
'@types/canvas-confetti':
specifier: 1.9.0
version: 1.9.0
@@ -2504,9 +2510,23 @@ packages:
resolution: {integrity: sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==}
+ '@tanstack/[email protected]':
+ resolution: {integrity: sha512-hYkhWr3UP0CkAsn/phBVR98UQawbw8CmTSgWtdgEBUjI60/GBaEIkpgi/Bp/2I8eIDK4+vdY7ac6jZx+GR+hEQ==}
+ peerDependencies:
+ eslint: ^8.57.0 || ^9.0.0
+
'@tanstack/[email protected]':
resolution: {integrity: sha512-s09l5zeUKC8q7DCCCIkVSns8zZrK4ZDT6ryEjxNBFi68G4z2EBobBS7rdOY3r6W1WbUDpc1fe5oY+YO/+2UVUg==}
+ '@tanstack/[email protected]':
+ resolution: {integrity: sha512-D6gH4asyjaoXrCOt5vG5Og/YSj0D/TxwNQgtLJIgWbhbWCC/emu2E92EFoVHh4ppVWg1qT2gKHvKyQBEFZhCuA==}
+
+ '@tanstack/[email protected]':
+ resolution: {integrity: sha512-6JL63fSc7kxyGOLV2w466SxhMn/m7LZk/ximQciy6OpVt+n2A8Mq3S0QwhIzfm4WEwLK/F3OELfzRToQburnYA==}
+ peerDependencies:
+ '@tanstack/react-query': ^5.80.10
+ react: ^18 || ^19
+
'@tanstack/[email protected]':
resolution: {integrity: sha512-u2F0VK6+anItoEvB3+rfvTO9GEh2vb00Je05OwlUe/A0lkJBgW1HckiY3f9YZa+jx6IOe4dHPh10dyp9aY3iRQ==}
peerDependencies:
@@ -3733,8 +3753,8 @@ packages:
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
- resolution: {integrity: sha512-GP+M7aeluQo9uAyiTCxgIj/j+PrWhMlY7LFVj8prlsPljd0Fdg9AprlfUi+OCSFWy9Y5/2D/Jrj9HS8Z4rpKWA==}
+ resolution: {integrity: sha512-q7SQx6mkLy0GTJK9K9OiWeaBMV4XQtBSdf6MJUzDB/H/5tFXfIiX38Lci1Kl6SsgiEhz1SQI1ejEOU5asWEhwQ==}
resolution: {integrity: sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g==}
@@ -6037,8 +6057,8 @@ packages:
uglify-js:
optional: true
- resolution: {integrity: sha512-+6erLbBm0+LROX2sPXlUYx/ux5PyE9K/a92Wrt6oA+WDAoFTdpHE5tCYCI5PNzq2y8df4rA+QgHLJuR4jNymsg==}
+ resolution: {integrity: sha512-UYCvU9YQW2f/Vwl+P0GfhxJxbUGLwd+5QrrGgLajzWAtC/23AX0vcise32kkP7Eu0Wu9VlzzHAXkLObgjQfFlQ==}
engines: {node: '>=10'}
hasBin: true
@@ -8944,8 +8964,24 @@ snapshots:
dependencies:
tslib: 2.8.1
+ dependencies:
+ '@typescript-eslint/utils': 8.34.1([email protected])([email protected])
+ eslint: 8.57.1
+ transitivePeerDependencies:
+ - supports-color
+ - typescript
+
'@tanstack/[email protected]': {}
+ '@tanstack/[email protected]': {}
+
+ dependencies:
+ '@tanstack/query-devtools': 5.80.0
+ '@tanstack/react-query': 5.80.7([email protected])
+ react: 18.3.1
+
dependencies:
'@tanstack/query-core': 5.80.7
@@ -9767,7 +9803,7 @@ snapshots:
dependencies:
caniuse-lite: 1.0.30001723
- electron-to-chromium: 1.5.170
+ electron-to-chromium: 1.5.169
node-releases: 2.0.19
update-browserslist-db: 1.1.3([email protected])
@@ -10276,7 +10312,7 @@ snapshots:
dependencies:
@@ -11035,7 +11071,7 @@ snapshots:
he: 1.2.0
param-case: 3.0.4
relateurl: 0.2.7
- terser: 5.43.1
+ terser: 5.42.0
@@ -13045,12 +13081,12 @@ snapshots:
jest-worker: 27.5.1
schema-utils: 4.3.2
serialize-javascript: 6.0.2
- terser: 5.43.1
+ terser: 5.42.0
webpack: 5.99.9([email protected])
optionalDependencies:
esbuild: 0.25.5
dependencies:
'@jridgewell/source-map': 0.3.6
acorn: 8.15.0
diff --git a/autogpt_platform/frontend/src/app/layout.tsx b/autogpt_platform/frontend/src/app/layout.tsx
index df8887eff5..d99e0b15d2 100644
--- a/autogpt_platform/frontend/src/app/layout.tsx
+++ b/autogpt_platform/frontend/src/app/layout.tsx
@@ -8,6 +8,7 @@ import { Toaster } from "@/components/ui/toaster";
import { Providers } from "@/app/providers";
import TallyPopupSimple from "@/components/TallyPopup";
import { GoogleAnalytics } from "@/components/analytics/google-analytics";
+import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
export const metadata: Metadata = {
title: "AutoGPT Platform",
@@ -41,6 +42,14 @@ export default async function RootLayout({
<div className="flex min-h-screen flex-col items-stretch justify-items-stretch">
{children}
<TallyPopupSimple />
+
+ {/* React Query DevTools is only available in development */}
+ {process.env.NEXT_PUBLIC_REACT_QUERY_DEVTOOL && (
+ <ReactQueryDevtools
+ initialIsOpen={false}
+ buttonPosition={"bottom-left"}
+ />
+ )}
</div>
<Toaster />
</Providers>