Gathering detailed insights and metrics for react-query-external-sync
Gathering detailed insights and metrics for react-query-external-sync
Gathering detailed insights and metrics for react-query-external-sync
Gathering detailed insights and metrics for react-query-external-sync
A powerful debugging tool that syncs React Query state, device storage (MMKV, AsyncStorage, SecureStorage), and environment variables from your React/React Native app to an external dashboard via Socket.IO. Perfect for real-time debugging across web, mobile, desktop, and TV platforms with zero production impact.
npm install react-query-external-sync
Typescript
Module System
Node Version
NPM Version
79.2
Supply Chain
98.2
Quality
88.3
Maintenance
100
Vulnerability
100
License
Release v2.2.3
Updated on Jun 18, 2025
Release v2.2.2
Updated on Jun 06, 2025
Release v2.2.1
Updated on Jun 06, 2025
📦 Device Storage Monitoring & Environment Variables Support
Updated on May 27, 2025
GC and clear cache fix
Updated on May 11, 2025
v2.0 - Universal React Query DevTools with Zero-Config Production Safety
Updated on Apr 08, 2025
TypeScript (91.51%)
JavaScript (8.49%)
Total Downloads
10,697
Last Day
116
Last Week
2,429
Last Month
5,505
Last Year
10,515
MIT License
105 Stars
65 Commits
9 Forks
1 Watchers
6 Branches
3 Contributors
Updated on Jul 07, 2025
Minified
Minified + Gzipped
Latest Version
2.2.3
Package Id
react-query-external-sync@2.2.3
Unpacked Size
214.45 kB
Size
41.87 kB
File Count
59
NPM Version
10.8.2
Node Version
20.19.2
Published on
Jun 18, 2025
Cumulative downloads
Total Downloads
3
A powerful debugging tool for React Query state and device storage in any React-based application. Whether you're building for mobile, web, desktop, TV, or VR - this package has you covered. It works seamlessly across all platforms where React runs, with zero configuration to disable in production.
Pairs perfectly with React Native DevTools for a complete development experience.
https://github.com/LovesWorking/react-native-react-query-devtools
1# Using npm 2npm install --save-dev react-query-external-sync socket.io-client 3 4# Using yarn 5yarn add -D react-query-external-sync socket.io-client 6 7# Using pnpm 8pnpm add -D react-query-external-sync socket.io-client
Add the hook to your application where you set up your React Query context:
1import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
2import { useSyncQueriesExternal } from "react-query-external-sync";
3import { Platform } from "react-native";
4import AsyncStorage from "@react-native-async-storage/async-storage";
5import * as SecureStore from "expo-secure-store";
6import { storage } from "./mmkv"; // Your MMKV instance
7
8// Create your query client
9const queryClient = new QueryClient();
10
11function App() {
12 return (
13 <QueryClientProvider client={queryClient}>
14 <AppContent />
15 </QueryClientProvider>
16 );
17}
18
19function AppContent() {
20 // Unified storage queries and external sync - all in one hook!
21 useSyncQueriesExternal({
22 queryClient,
23 socketURL: "http://localhost:42831",
24 deviceName: Platform.OS,
25 platform: Platform.OS,
26 deviceId: Platform.OS,
27 extraDeviceInfo: {
28 appVersion: "1.0.0",
29 },
30 enableLogs: true,
31 envVariables: {
32 NODE_ENV: process.env.NODE_ENV,
33 },
34 // Storage monitoring with CRUD operations
35 mmkvStorage: storage, // MMKV storage for ['#storage', 'mmkv', 'key'] queries + monitoring
36 asyncStorage: AsyncStorage, // AsyncStorage for ['#storage', 'async', 'key'] queries + monitoring
37 secureStorage: SecureStore, // SecureStore for ['#storage', 'secure', 'key'] queries + monitoring
38 secureStorageKeys: [
39 "userToken",
40 "refreshToken",
41 "biometricKey",
42 "deviceId",
43 ], // SecureStore keys to monitor
44 });
45
46 // Your app content
47 return <YourApp />;
48}
This package is automatically disabled in production builds.
1// The package handles this internally: 2if (process.env.NODE_ENV !== "production") { 3 useSyncQueries = require("./new-sync/useSyncQueries").useSyncQueries; 4} else { 5 // In production, this becomes a no-op function 6 useSyncQueries = () => ({ 7 isConnected: false, 8 connect: () => {}, 9 disconnect: () => {}, 10 socket: null, 11 users: [], 12 }); 13}
For the best experience, use this package with the React Native DevTools application:
Note: For optimal connection, launch DevTools before starting your application.
The useSyncQueriesExternal
hook accepts the following options:
Option | Type | Required | Description |
---|---|---|---|
queryClient | QueryClient | Yes | Your React Query client instance |
socketURL | string | Yes | URL of the socket server (e.g., 'http://localhost:42831') |
deviceName | string | Yes | Human-readable name for your device |
platform | string | Yes | Platform identifier ('ios', 'android', 'web', 'macos', 'windows', etc.) |
deviceId | string | Yes | Unique identifier for your device |
extraDeviceInfo | object | No | Additional device metadata to display in DevTools |
enableLogs | boolean | No | Enable console logging for debugging (default: false) |
isDevice | boolean | No | Set to true if this is a device (default: false) |
envVariables | object | No | Environment variables to sync with DevTools |
mmkvStorage | MmkvStorage | No | MMKV storage instance for real-time monitoring |
asyncStorage | AsyncStorage | No | AsyncStorage instance for polling-based monitoring |
secureStorage | SecureStore | No | SecureStore instance for secure data monitoring |
secureStorageKeys | string[] | No | Array of SecureStore keys to monitor (required if using secureStorage) |
DevTools Connection
No Devices Appearing
npm list socket.io-client
)socketURL
matches the DevTools port (default: 42831)Data Not Syncing
queryClient
instanceenableLogs: true
to see connection informationThat's it! If you're still having issues, visit the GitHub repository for support.
The deviceId
parameter must be persistent across app restarts and re-renders. Using a value that changes (like Date.now()
) will cause each render to be treated as a new device.
Recommended approaches:
1// Simple approach for single devices
2deviceId: Platform.OS, // Works if you only have one device per platform
3
4// Better approach for multiple simulators/devices of same type
5// Using AsyncStorage, MMKV, or another storage solution
6const [deviceId, setDeviceId] = useState(Platform.OS);
7
8useEffect(() => {
9 const loadOrCreateDeviceId = async () => {
10 // Try to load existing ID
11 const storedId = await AsyncStorage.getItem('deviceId');
12
13 if (storedId) {
14 setDeviceId(storedId);
15 } else {
16 // First launch - generate and store a persistent ID
17 const newId = `${Platform.OS}-${Date.now()}`;
18 await AsyncStorage.setItem('deviceId', newId);
19 setDeviceId(newId);
20 }
21 };
22
23 loadOrCreateDeviceId();
24}, []);
MIT
Made with ❤️ by LovesWorking
No vulnerabilities found.
No security vulnerabilities found.
Last Day
46.8%
116
Compared to previous day
Last Week
53.3%
2,429
Compared to previous week
Last Month
318.3%
5,505
Compared to previous month
Last Year
5,677.5%
10,515
Compared to previous year