|
1 | | -# React + TypeScript + Vite |
2 | | - |
3 | | -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. |
4 | | - |
5 | | -Currently, two official plugins are available: |
6 | | - |
7 | | -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh |
8 | | -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh |
9 | | - |
10 | | -## Expanding the ESLint configuration |
11 | | - |
12 | | -If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules: |
13 | | - |
14 | | -```js |
15 | | -export default tseslint.config({ |
16 | | - extends: [ |
17 | | - // Remove ...tseslint.configs.recommended and replace with this |
18 | | - ...tseslint.configs.recommendedTypeChecked, |
19 | | - // Alternatively, use this for stricter rules |
20 | | - ...tseslint.configs.strictTypeChecked, |
21 | | - // Optionally, add this for stylistic rules |
22 | | - ...tseslint.configs.stylisticTypeChecked, |
23 | | - ], |
24 | | - languageOptions: { |
25 | | - // other options... |
26 | | - parserOptions: { |
27 | | - project: ['./tsconfig.node.json', './tsconfig.app.json'], |
28 | | - tsconfigRootDir: import.meta.dirname, |
29 | | - }, |
30 | | - }, |
31 | | -}) |
| 1 | +# TanStack Query Chrome DevTools |
| 2 | + |
| 3 | +A professional Chrome DevTools extension for debugging TanStack Query applications across all frameworks. |
| 4 | + |
| 5 | +[](https://chromewebstore.google.com/detail/tanstack-query-devtools/annajfchloimdhceglpgglpeepfghfai) |
| 6 | + |
| 7 | +## ✨ Features |
| 8 | + |
| 9 | +### 🔍 Advanced Debugging Capabilities |
| 10 | + |
| 11 | +- **Real-time Query Inspection** - Live monitoring of all queries and mutations with instant state updates |
| 12 | +- **Interactive Data Editing** - Edit query data directly in DevTools using professional JsonView interface |
| 13 | +- **State Manipulation** - Trigger loading and error states for comprehensive UI testing |
| 14 | +- **Complete Cache Management** - Invalidate, refetch, reset, and remove queries with one-click actions |
| 15 | +- **Mutation Tracking** - Monitor mutations with variables, status, and result inspection |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | +## Quick Start |
| 20 | + |
| 21 | +1. **Install** the extension from [Chrome Web Store](https://chromewebstore.google.com/detail/tanstack-query-devtools/annajfchloimdhceglpgglpeepfghfai) |
| 22 | +2. **Setup your application** to expose the query client globally: |
| 23 | + |
| 24 | + ```typescript |
| 25 | + // Add this line where you create your query client |
| 26 | + window.__TANSTACK_QUERY_CLIENT__ = queryClient; |
| 27 | + ``` |
| 28 | + |
| 29 | +3. **For TypeScript projects**, create a `global.d.ts` file in your project root: |
| 30 | + |
| 31 | + ```typescript |
| 32 | + interface Window { |
| 33 | + __TANSTACK_QUERY_CLIENT__: import("@tanstack/query-core").QueryClient; |
| 34 | + } |
| 35 | + ``` |
| 36 | + |
| 37 | +4. **Open** Chrome DevTools (F12) in your application |
| 38 | +5. **Navigate** to the "TanStack Query" tab |
| 39 | +6. **Start debugging** with real-time query inspection! |
| 40 | + |
| 41 | +## 🏗️ Technical Architecture |
| 42 | + |
| 43 | +### Multi-Context Extension Pattern |
| 44 | + |
| 45 | +``` |
| 46 | +Web Application (TanStack Query) |
| 47 | + ↓ Detection & State Extraction |
| 48 | +Injected Script (Application Context) |
| 49 | + ↓ Message Passing |
| 50 | +Content Script (Bridge) |
| 51 | + ↓ Chrome APIs |
| 52 | +Background Service Worker |
| 53 | + ↓ DevTools Connection |
| 54 | +React DevTools Panel |
32 | 55 | ``` |
33 | 56 |
|
34 | | -You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules: |
35 | | - |
36 | | -```js |
37 | | -// eslint.config.js |
38 | | -import reactX from 'eslint-plugin-react-x' |
39 | | -import reactDom from 'eslint-plugin-react-dom' |
40 | | - |
41 | | -export default tseslint.config({ |
42 | | - plugins: { |
43 | | - // Add the react-x and react-dom plugins |
44 | | - 'react-x': reactX, |
45 | | - 'react-dom': reactDom, |
46 | | - }, |
47 | | - rules: { |
48 | | - // other rules... |
49 | | - // Enable its recommended typescript rules |
50 | | - ...reactX.configs['recommended-typescript'].rules, |
51 | | - ...reactDom.configs.recommended.rules, |
52 | | - }, |
53 | | -}) |
| 57 | +## 🔧 Development |
| 58 | + |
| 59 | +### Local Development Setup |
| 60 | + |
| 61 | +```bash |
| 62 | +# Install dependencies |
| 63 | +npm install |
| 64 | + |
| 65 | +# Build extension |
| 66 | +npm run build |
| 67 | + |
| 68 | +# Load extension in Chrome |
| 69 | +# 1. Open chrome://extensions/ |
| 70 | +# 2. Enable "Developer mode" |
| 71 | +# 3. Click "Load unpacked" |
| 72 | +# 4. Select the `dist` folder |
54 | 73 | ``` |
| 74 | + |
| 75 | +## 🔗 Links |
| 76 | + |
| 77 | +- [Chrome Web Store](https://chromewebstore.google.com/detail/tanstack-query-devtools/annajfchloimdhceglpgglpeepfghfai) |
| 78 | +- [TanStack Query Documentation](https://tanstack.com/query) |
| 79 | +- [Chrome Extension Development](https://developer.chrome.com/docs/extensions/) |
0 commit comments