@buoy-gg/react-query 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +389 -0
- package/lib/commonjs/index.js +107 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/preset.js +220 -0
- package/lib/commonjs/react-query/ReactQueryDevTools.js +335 -0
- package/lib/commonjs/react-query/components/DataEditorMode.js +316 -0
- package/lib/commonjs/react-query/components/FilterStatusBadge.js +51 -0
- package/lib/commonjs/react-query/components/MutationBrowserMode.js +51 -0
- package/lib/commonjs/react-query/components/MutationEditorMode.js +257 -0
- package/lib/commonjs/react-query/components/QueryBrowserMode.js +82 -0
- package/lib/commonjs/react-query/components/QueryDebugInfo.js +107 -0
- package/lib/commonjs/react-query/components/QueryFilterViewV3.js +221 -0
- package/lib/commonjs/react-query/components/QuerySelector.js +208 -0
- package/lib/commonjs/react-query/components/ReactQueryDevToolsModal.js +76 -0
- package/lib/commonjs/react-query/components/ReactQuerySection.js +47 -0
- package/lib/commonjs/react-query/components/WifiToggle.js +49 -0
- package/lib/commonjs/react-query/components/index.js +253 -0
- package/lib/commonjs/react-query/components/modals/DataEditorModal.js +70 -0
- package/lib/commonjs/react-query/components/modals/MutationBrowserFooter.js +69 -0
- package/lib/commonjs/react-query/components/modals/MutationBrowserModal.js +146 -0
- package/lib/commonjs/react-query/components/modals/MutationEditorModal.js +58 -0
- package/lib/commonjs/react-query/components/modals/QueryBrowserFooter.js +63 -0
- package/lib/commonjs/react-query/components/modals/QueryBrowserModal.js +237 -0
- package/lib/commonjs/react-query/components/modals/ReactQueryModal.js +83 -0
- package/lib/commonjs/react-query/components/modals/ReactQueryModalHeader.js +171 -0
- package/lib/commonjs/react-query/components/modals/SwipeIndicator.js +204 -0
- package/lib/commonjs/react-query/components/query-browser/ActionButton.js +127 -0
- package/lib/commonjs/react-query/components/query-browser/ClearCacheButton.js +53 -0
- package/lib/commonjs/react-query/components/query-browser/Explorer.js +985 -0
- package/lib/commonjs/react-query/components/query-browser/MutationButton.js +184 -0
- package/lib/commonjs/react-query/components/query-browser/MutationDetails.js +122 -0
- package/lib/commonjs/react-query/components/query-browser/MutationDetailsChips.js +66 -0
- package/lib/commonjs/react-query/components/query-browser/MutationInformation.js +117 -0
- package/lib/commonjs/react-query/components/query-browser/MutationStatusCount.js +111 -0
- package/lib/commonjs/react-query/components/query-browser/MutationsList.js +212 -0
- package/lib/commonjs/react-query/components/query-browser/NetworkToggleButton.js +54 -0
- package/lib/commonjs/react-query/components/query-browser/QueryActions.js +138 -0
- package/lib/commonjs/react-query/components/query-browser/QueryBrowser.js +146 -0
- package/lib/commonjs/react-query/components/query-browser/QueryDetails.js +137 -0
- package/lib/commonjs/react-query/components/query-browser/QueryDetailsChip.js +76 -0
- package/lib/commonjs/react-query/components/query-browser/QueryInformation.js +94 -0
- package/lib/commonjs/react-query/components/query-browser/QueryRow.js +93 -0
- package/lib/commonjs/react-query/components/query-browser/QueryStatus.js +125 -0
- package/lib/commonjs/react-query/components/query-browser/QueryStatusCount.js +130 -0
- package/lib/commonjs/react-query/components/query-browser/StorageStatusCount.js +106 -0
- package/lib/commonjs/react-query/components/query-browser/index.js +170 -0
- package/lib/commonjs/react-query/components/query-browser/svgs.js +74 -0
- package/lib/commonjs/react-query/hooks/index.js +96 -0
- package/lib/commonjs/react-query/hooks/useActionButtons.js +59 -0
- package/lib/commonjs/react-query/hooks/useAllMutations.js +35 -0
- package/lib/commonjs/react-query/hooks/useAllQueries.js +117 -0
- package/lib/commonjs/react-query/hooks/useModalManager.js +178 -0
- package/lib/commonjs/react-query/hooks/useModalPersistence.js +71 -0
- package/lib/commonjs/react-query/hooks/useMutationActionButtons.js +22 -0
- package/lib/commonjs/react-query/hooks/useQueryStatusCounts.js +110 -0
- package/lib/commonjs/react-query/hooks/useReactQueryState.js +24 -0
- package/lib/commonjs/react-query/hooks/useSelectedMutation.js +30 -0
- package/lib/commonjs/react-query/hooks/useSelectedQuery.js +96 -0
- package/lib/commonjs/react-query/hooks/useStorageQueryCounts.js +28 -0
- package/lib/commonjs/react-query/hooks/useWifiState.js +67 -0
- package/lib/commonjs/react-query/index.js +16 -0
- package/lib/commonjs/react-query/types/index.js +16 -0
- package/lib/commonjs/react-query/types/types.js +14 -0
- package/lib/commonjs/react-query/utils/actions/deleteItem.js +23 -0
- package/lib/commonjs/react-query/utils/actions/invalidate.js +13 -0
- package/lib/commonjs/react-query/utils/actions/refetch.js +15 -0
- package/lib/commonjs/react-query/utils/actions/remove.js +12 -0
- package/lib/commonjs/react-query/utils/actions/reset.js +15 -0
- package/lib/commonjs/react-query/utils/actions/triggerError.js +30 -0
- package/lib/commonjs/react-query/utils/actions/triggerLoading.js +51 -0
- package/lib/commonjs/react-query/utils/deleteNestedDataByPath.js +56 -0
- package/lib/commonjs/react-query/utils/formatRelativeTime.js +29 -0
- package/lib/commonjs/react-query/utils/getQueryStatusColor.js +16 -0
- package/lib/commonjs/react-query/utils/getQueryStatusLabel.js +17 -0
- package/lib/commonjs/react-query/utils/getStorageQueryCounts.js +35 -0
- package/lib/commonjs/react-query/utils/index.js +170 -0
- package/lib/commonjs/react-query/utils/modalStorageOperations.js +127 -0
- package/lib/commonjs/react-query/utils/storageQueryUtils.js +149 -0
- package/lib/commonjs/react-query/utils/updateNestedDataByPath.js +61 -0
- package/lib/module/index.js +19 -0
- package/lib/module/preset.js +216 -0
- package/lib/module/react-query/ReactQueryDevTools.js +68 -0
- package/lib/module/react-query/components/DataEditorMode.js +310 -0
- package/lib/module/react-query/components/FilterStatusBadge.js +47 -0
- package/lib/module/react-query/components/MutationBrowserMode.js +46 -0
- package/lib/module/react-query/components/MutationEditorMode.js +252 -0
- package/lib/module/react-query/components/QueryBrowserMode.js +77 -0
- package/lib/module/react-query/components/QueryDebugInfo.js +104 -0
- package/lib/module/react-query/components/QueryFilterViewV3.js +218 -0
- package/lib/module/react-query/components/QuerySelector.js +204 -0
- package/lib/module/react-query/components/ReactQueryDevToolsModal.js +72 -0
- package/lib/module/react-query/components/ReactQuerySection.js +43 -0
- package/lib/module/react-query/components/WifiToggle.js +46 -0
- package/lib/module/react-query/components/index.js +29 -0
- package/lib/module/react-query/components/modals/DataEditorModal.js +66 -0
- package/lib/module/react-query/components/modals/MutationBrowserFooter.js +64 -0
- package/lib/module/react-query/components/modals/MutationBrowserModal.js +143 -0
- package/lib/module/react-query/components/modals/MutationEditorModal.js +54 -0
- package/lib/module/react-query/components/modals/QueryBrowserFooter.js +58 -0
- package/lib/module/react-query/components/modals/QueryBrowserModal.js +233 -0
- package/lib/module/react-query/components/modals/ReactQueryModal.js +79 -0
- package/lib/module/react-query/components/modals/ReactQueryModalHeader.js +167 -0
- package/lib/module/react-query/components/modals/SwipeIndicator.js +200 -0
- package/lib/module/react-query/components/query-browser/ActionButton.js +124 -0
- package/lib/module/react-query/components/query-browser/ClearCacheButton.js +49 -0
- package/lib/module/react-query/components/query-browser/Explorer.js +983 -0
- package/lib/module/react-query/components/query-browser/MutationButton.js +180 -0
- package/lib/module/react-query/components/query-browser/MutationDetails.js +117 -0
- package/lib/module/react-query/components/query-browser/MutationDetailsChips.js +62 -0
- package/lib/module/react-query/components/query-browser/MutationInformation.js +112 -0
- package/lib/module/react-query/components/query-browser/MutationStatusCount.js +106 -0
- package/lib/module/react-query/components/query-browser/MutationsList.js +207 -0
- package/lib/module/react-query/components/query-browser/NetworkToggleButton.js +50 -0
- package/lib/module/react-query/components/query-browser/QueryActions.js +133 -0
- package/lib/module/react-query/components/query-browser/QueryBrowser.js +141 -0
- package/lib/module/react-query/components/query-browser/QueryDetails.js +132 -0
- package/lib/module/react-query/components/query-browser/QueryDetailsChip.js +72 -0
- package/lib/module/react-query/components/query-browser/QueryInformation.js +89 -0
- package/lib/module/react-query/components/query-browser/QueryRow.js +89 -0
- package/lib/module/react-query/components/query-browser/QueryStatus.js +121 -0
- package/lib/module/react-query/components/query-browser/QueryStatusCount.js +125 -0
- package/lib/module/react-query/components/query-browser/StorageStatusCount.js +101 -0
- package/lib/module/react-query/components/query-browser/index.js +22 -0
- package/lib/module/react-query/components/query-browser/svgs.js +66 -0
- package/lib/module/react-query/hooks/index.js +23 -0
- package/lib/module/react-query/hooks/useActionButtons.js +54 -0
- package/lib/module/react-query/hooks/useAllMutations.js +32 -0
- package/lib/module/react-query/hooks/useAllQueries.js +114 -0
- package/lib/module/react-query/hooks/useModalManager.js +175 -0
- package/lib/module/react-query/hooks/useModalPersistence.js +67 -0
- package/lib/module/react-query/hooks/useMutationActionButtons.js +18 -0
- package/lib/module/react-query/hooks/useQueryStatusCounts.js +108 -0
- package/lib/module/react-query/hooks/useReactQueryState.js +20 -0
- package/lib/module/react-query/hooks/useSelectedMutation.js +27 -0
- package/lib/module/react-query/hooks/useSelectedQuery.js +92 -0
- package/lib/module/react-query/hooks/useStorageQueryCounts.js +25 -0
- package/lib/module/react-query/hooks/useWifiState.js +64 -0
- package/lib/module/react-query/index.js +3 -0
- package/lib/module/react-query/types/index.js +3 -0
- package/lib/module/react-query/types/types.js +10 -0
- package/lib/module/react-query/utils/actions/deleteItem.js +19 -0
- package/lib/module/react-query/utils/actions/invalidate.js +9 -0
- package/lib/module/react-query/utils/actions/refetch.js +11 -0
- package/lib/module/react-query/utils/actions/remove.js +8 -0
- package/lib/module/react-query/utils/actions/reset.js +11 -0
- package/lib/module/react-query/utils/actions/triggerError.js +26 -0
- package/lib/module/react-query/utils/actions/triggerLoading.js +47 -0
- package/lib/module/react-query/utils/deleteNestedDataByPath.js +51 -0
- package/lib/module/react-query/utils/formatRelativeTime.js +25 -0
- package/lib/module/react-query/utils/getQueryStatusColor.js +12 -0
- package/lib/module/react-query/utils/getQueryStatusLabel.js +13 -0
- package/lib/module/react-query/utils/getStorageQueryCounts.js +31 -0
- package/lib/module/react-query/utils/index.js +27 -0
- package/lib/module/react-query/utils/modalStorageOperations.js +117 -0
- package/lib/module/react-query/utils/storageQueryUtils.js +140 -0
- package/lib/module/react-query/utils/updateNestedDataByPath.js +56 -0
- package/lib/typescript/index.d.ts +7 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/preset.d.ts +160 -0
- package/lib/typescript/preset.d.ts.map +1 -0
- package/lib/typescript/react-query/ReactQueryDevTools.d.ts +45 -0
- package/lib/typescript/react-query/ReactQueryDevTools.d.ts.map +1 -0
- package/lib/typescript/react-query/components/DataEditorMode.d.ts +25 -0
- package/lib/typescript/react-query/components/DataEditorMode.d.ts.map +1 -0
- package/lib/typescript/react-query/components/FilterStatusBadge.d.ts +12 -0
- package/lib/typescript/react-query/components/FilterStatusBadge.d.ts.map +1 -0
- package/lib/typescript/react-query/components/MutationBrowserMode.d.ts +14 -0
- package/lib/typescript/react-query/components/MutationBrowserMode.d.ts.map +1 -0
- package/lib/typescript/react-query/components/MutationEditorMode.d.ts +12 -0
- package/lib/typescript/react-query/components/MutationEditorMode.d.ts.map +1 -0
- package/lib/typescript/react-query/components/QueryBrowserMode.d.ts +14 -0
- package/lib/typescript/react-query/components/QueryBrowserMode.d.ts.map +1 -0
- package/lib/typescript/react-query/components/QueryDebugInfo.d.ts +6 -0
- package/lib/typescript/react-query/components/QueryDebugInfo.d.ts.map +1 -0
- package/lib/typescript/react-query/components/QueryFilterViewV3.d.ts +17 -0
- package/lib/typescript/react-query/components/QueryFilterViewV3.d.ts.map +1 -0
- package/lib/typescript/react-query/components/QuerySelector.d.ts +15 -0
- package/lib/typescript/react-query/components/QuerySelector.d.ts.map +1 -0
- package/lib/typescript/react-query/components/ReactQueryDevToolsModal.d.ts +19 -0
- package/lib/typescript/react-query/components/ReactQueryDevToolsModal.d.ts.map +1 -0
- package/lib/typescript/react-query/components/ReactQuerySection.d.ts +11 -0
- package/lib/typescript/react-query/components/ReactQuerySection.d.ts.map +1 -0
- package/lib/typescript/react-query/components/WifiToggle.d.ts +8 -0
- package/lib/typescript/react-query/components/WifiToggle.d.ts.map +1 -0
- package/lib/typescript/react-query/components/index.d.ts +21 -0
- package/lib/typescript/react-query/components/index.d.ts.map +1 -0
- package/lib/typescript/react-query/components/modals/DataEditorModal.d.ts +17 -0
- package/lib/typescript/react-query/components/modals/DataEditorModal.d.ts.map +1 -0
- package/lib/typescript/react-query/components/modals/MutationBrowserFooter.d.ts +17 -0
- package/lib/typescript/react-query/components/modals/MutationBrowserFooter.d.ts.map +1 -0
- package/lib/typescript/react-query/components/modals/MutationBrowserModal.d.ts +21 -0
- package/lib/typescript/react-query/components/modals/MutationBrowserModal.d.ts.map +1 -0
- package/lib/typescript/react-query/components/modals/MutationEditorModal.d.ts +17 -0
- package/lib/typescript/react-query/components/modals/MutationEditorModal.d.ts.map +1 -0
- package/lib/typescript/react-query/components/modals/QueryBrowserFooter.d.ts +16 -0
- package/lib/typescript/react-query/components/modals/QueryBrowserFooter.d.ts.map +1 -0
- package/lib/typescript/react-query/components/modals/QueryBrowserModal.d.ts +21 -0
- package/lib/typescript/react-query/components/modals/QueryBrowserModal.d.ts.map +1 -0
- package/lib/typescript/react-query/components/modals/ReactQueryModal.d.ts +29 -0
- package/lib/typescript/react-query/components/modals/ReactQueryModal.d.ts.map +1 -0
- package/lib/typescript/react-query/components/modals/ReactQueryModalHeader.d.ts +19 -0
- package/lib/typescript/react-query/components/modals/ReactQueryModalHeader.d.ts.map +1 -0
- package/lib/typescript/react-query/components/modals/SwipeIndicator.d.ts +14 -0
- package/lib/typescript/react-query/components/modals/SwipeIndicator.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/ActionButton.d.ts +49 -0
- package/lib/typescript/react-query/components/query-browser/ActionButton.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/ClearCacheButton.d.ts +12 -0
- package/lib/typescript/react-query/components/query-browser/ClearCacheButton.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/Explorer.d.ts +19 -0
- package/lib/typescript/react-query/components/query-browser/Explorer.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/MutationButton.d.ts +12 -0
- package/lib/typescript/react-query/components/query-browser/MutationButton.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/MutationDetails.d.ts +10 -0
- package/lib/typescript/react-query/components/query-browser/MutationDetails.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/MutationDetailsChips.d.ts +10 -0
- package/lib/typescript/react-query/components/query-browser/MutationDetailsChips.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/MutationInformation.d.ts +8 -0
- package/lib/typescript/react-query/components/query-browser/MutationInformation.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/MutationStatusCount.d.ts +12 -0
- package/lib/typescript/react-query/components/query-browser/MutationStatusCount.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/MutationsList.d.ts +17 -0
- package/lib/typescript/react-query/components/query-browser/MutationsList.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/NetworkToggleButton.d.ts +11 -0
- package/lib/typescript/react-query/components/query-browser/NetworkToggleButton.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/QueryActions.d.ts +12 -0
- package/lib/typescript/react-query/components/query-browser/QueryActions.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/QueryBrowser.d.ts +19 -0
- package/lib/typescript/react-query/components/query-browser/QueryBrowser.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/QueryDetails.d.ts +10 -0
- package/lib/typescript/react-query/components/query-browser/QueryDetails.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/QueryDetailsChip.d.ts +10 -0
- package/lib/typescript/react-query/components/query-browser/QueryDetailsChip.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/QueryInformation.d.ts +12 -0
- package/lib/typescript/react-query/components/query-browser/QueryInformation.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/QueryRow.d.ts +12 -0
- package/lib/typescript/react-query/components/query-browser/QueryRow.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/QueryStatus.d.ts +17 -0
- package/lib/typescript/react-query/components/query-browser/QueryStatus.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/QueryStatusCount.d.ts +11 -0
- package/lib/typescript/react-query/components/query-browser/QueryStatusCount.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/StorageStatusCount.d.ts +18 -0
- package/lib/typescript/react-query/components/query-browser/StorageStatusCount.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/index.d.ts +21 -0
- package/lib/typescript/react-query/components/query-browser/index.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/svgs.d.ts +17 -0
- package/lib/typescript/react-query/components/query-browser/svgs.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/index.d.ts +13 -0
- package/lib/typescript/react-query/hooks/index.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/useActionButtons.d.ts +21 -0
- package/lib/typescript/react-query/hooks/useActionButtons.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/useAllMutations.d.ts +10 -0
- package/lib/typescript/react-query/hooks/useAllMutations.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/useAllQueries.d.ts +12 -0
- package/lib/typescript/react-query/hooks/useAllQueries.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/useModalManager.d.ts +39 -0
- package/lib/typescript/react-query/hooks/useModalManager.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/useModalPersistence.d.ts +29 -0
- package/lib/typescript/react-query/hooks/useModalPersistence.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/useMutationActionButtons.d.ts +15 -0
- package/lib/typescript/react-query/hooks/useMutationActionButtons.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/useQueryStatusCounts.d.ts +25 -0
- package/lib/typescript/react-query/hooks/useQueryStatusCounts.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/useReactQueryState.d.ts +9 -0
- package/lib/typescript/react-query/hooks/useReactQueryState.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/useSelectedMutation.d.ts +7 -0
- package/lib/typescript/react-query/hooks/useSelectedMutation.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/useSelectedQuery.d.ts +25 -0
- package/lib/typescript/react-query/hooks/useSelectedQuery.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/useStorageQueryCounts.d.ts +10 -0
- package/lib/typescript/react-query/hooks/useStorageQueryCounts.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/useWifiState.d.ts +9 -0
- package/lib/typescript/react-query/hooks/useWifiState.d.ts.map +1 -0
- package/lib/typescript/react-query/index.d.ts +2 -0
- package/lib/typescript/react-query/index.d.ts.map +1 -0
- package/lib/typescript/react-query/types/index.d.ts +2 -0
- package/lib/typescript/react-query/types/index.d.ts.map +1 -0
- package/lib/typescript/react-query/types/types.d.ts +10 -0
- package/lib/typescript/react-query/types/types.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/actions/deleteItem.d.ts +9 -0
- package/lib/typescript/react-query/utils/actions/deleteItem.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/actions/invalidate.d.ts +8 -0
- package/lib/typescript/react-query/utils/actions/invalidate.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/actions/refetch.d.ts +7 -0
- package/lib/typescript/react-query/utils/actions/refetch.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/actions/remove.d.ts +8 -0
- package/lib/typescript/react-query/utils/actions/remove.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/actions/reset.d.ts +8 -0
- package/lib/typescript/react-query/utils/actions/reset.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/actions/triggerError.d.ts +8 -0
- package/lib/typescript/react-query/utils/actions/triggerError.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/actions/triggerLoading.d.ts +7 -0
- package/lib/typescript/react-query/utils/actions/triggerLoading.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/deleteNestedDataByPath.d.ts +9 -0
- package/lib/typescript/react-query/utils/deleteNestedDataByPath.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/formatRelativeTime.d.ts +7 -0
- package/lib/typescript/react-query/utils/formatRelativeTime.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/getQueryStatusColor.d.ts +10 -0
- package/lib/typescript/react-query/utils/getQueryStatusColor.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/getQueryStatusLabel.d.ts +9 -0
- package/lib/typescript/react-query/utils/getQueryStatusLabel.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/getStorageQueryCounts.d.ts +13 -0
- package/lib/typescript/react-query/utils/getStorageQueryCounts.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/index.d.ts +17 -0
- package/lib/typescript/react-query/utils/index.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/modalStorageOperations.d.ts +55 -0
- package/lib/typescript/react-query/utils/modalStorageOperations.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/storageQueryUtils.d.ts +69 -0
- package/lib/typescript/react-query/utils/storageQueryUtils.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/updateNestedDataByPath.d.ts +10 -0
- package/lib/typescript/react-query/utils/updateNestedDataByPath.d.ts.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Query and Mutation hooks
|
|
4
|
+
export { default as useAllQueries } from "./useAllQueries";
|
|
5
|
+
export { default as useAllMutations } from "./useAllMutations";
|
|
6
|
+
export { useGetQueryByQueryKey, useGetQueryByQueryKeyWithVersion } from "./useSelectedQuery";
|
|
7
|
+
export { useGetMutationById } from "./useSelectedMutation";
|
|
8
|
+
export { default as useQueryStatusCounts } from "./useQueryStatusCounts";
|
|
9
|
+
export { useStorageQueryCounts } from "./useStorageQueryCounts";
|
|
10
|
+
|
|
11
|
+
// React Query state hooks
|
|
12
|
+
export { useReactQueryState } from "./useReactQueryState";
|
|
13
|
+
|
|
14
|
+
// Action button hooks
|
|
15
|
+
export { useActionButtons } from "./useActionButtons";
|
|
16
|
+
export { useMutationActionButtons } from "./useMutationActionButtons";
|
|
17
|
+
|
|
18
|
+
// Modal management hooks
|
|
19
|
+
export { useModalManager } from "./useModalManager";
|
|
20
|
+
export { useModalPersistence } from "./useModalPersistence";
|
|
21
|
+
|
|
22
|
+
// WiFi state hook
|
|
23
|
+
export { useWifiState } from "./useWifiState";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import triggerLoading from "../utils/actions/triggerLoading";
|
|
5
|
+
import refetch from "../utils/actions/refetch";
|
|
6
|
+
import triggerError from "../utils/actions/triggerError";
|
|
7
|
+
import { getQueryStatusLabel } from "../utils/getQueryStatusLabel";
|
|
8
|
+
/**
|
|
9
|
+
* Derives the default action button configuration for an inspected query. Encapsulates business
|
|
10
|
+
* rules around when to show refetch, loading, or error simulation actions.
|
|
11
|
+
*
|
|
12
|
+
* @param selectedQuery - The query to derive actions for
|
|
13
|
+
* @param queryClient - The query client for executing actions
|
|
14
|
+
* @param queryVersion - Optional version number that increments on query state changes.
|
|
15
|
+
* React Query mutates Query objects in place, so this version ensures
|
|
16
|
+
* the useMemo recomputes when state changes.
|
|
17
|
+
*/
|
|
18
|
+
export function useActionButtons(selectedQuery, queryClient, queryVersion) {
|
|
19
|
+
const actionButtons = useMemo(() => {
|
|
20
|
+
const queryStatus = selectedQuery.state.status;
|
|
21
|
+
const isFetching = getQueryStatusLabel(selectedQuery) === "fetching";
|
|
22
|
+
const buttons = [{
|
|
23
|
+
label: "Refetch",
|
|
24
|
+
bgColorClass: "btnRefetch",
|
|
25
|
+
textColorClass: "btnRefetch",
|
|
26
|
+
disabled: isFetching,
|
|
27
|
+
onPress: () => refetch({
|
|
28
|
+
query: selectedQuery
|
|
29
|
+
})
|
|
30
|
+
}, {
|
|
31
|
+
label: selectedQuery.state.fetchStatus === "fetching" ? "Restore" : "Loading",
|
|
32
|
+
bgColorClass: "btnTriggerLoading",
|
|
33
|
+
textColorClass: "btnTriggerLoading",
|
|
34
|
+
disabled: false,
|
|
35
|
+
onPress: () => triggerLoading({
|
|
36
|
+
query: selectedQuery
|
|
37
|
+
})
|
|
38
|
+
}, {
|
|
39
|
+
label: queryStatus === "error" ? "Restore" : "Error",
|
|
40
|
+
bgColorClass: "btnTriggerLoadiError",
|
|
41
|
+
textColorClass: "btnTriggerLoadiError",
|
|
42
|
+
disabled: queryStatus === "pending",
|
|
43
|
+
onPress: () => triggerError({
|
|
44
|
+
query: selectedQuery,
|
|
45
|
+
queryClient
|
|
46
|
+
})
|
|
47
|
+
}];
|
|
48
|
+
return buttons;
|
|
49
|
+
// queryVersion is the key dependency that ensures this recomputes when query state changes.
|
|
50
|
+
// React Query mutates Query objects in place, so comparing selectedQuery.state.* values
|
|
51
|
+
// doesn't work reliably (the "previous" and "current" values read from the same mutated object).
|
|
52
|
+
}, [selectedQuery, queryClient, queryVersion]);
|
|
53
|
+
return actionButtons;
|
|
54
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Tracks all active React Query mutations with lightweight change detection. Debounces cache
|
|
8
|
+
* updates so large mutation batches do not thrash the UI thread on mobile.
|
|
9
|
+
*/
|
|
10
|
+
function useAllMutations() {
|
|
11
|
+
const queryClient = useQueryClient();
|
|
12
|
+
const [mutations, setMutations] = useState([]);
|
|
13
|
+
const mutationsSnapshotRef = useRef(null);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const updateMutations = () => {
|
|
16
|
+
const newMutations = queryClient.getMutationCache().getAll();
|
|
17
|
+
const newStates = newMutations.map(m => m.state);
|
|
18
|
+
const snapshot = JSON.stringify(newStates);
|
|
19
|
+
if (mutationsSnapshotRef.current !== snapshot) {
|
|
20
|
+
mutationsSnapshotRef.current = snapshot;
|
|
21
|
+
setTimeout(() => setMutations(newMutations), 0);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
setTimeout(updateMutations, 0);
|
|
25
|
+
const unsubscribe = queryClient.getMutationCache().subscribe(updateMutations);
|
|
26
|
+
return () => unsubscribe();
|
|
27
|
+
}, [queryClient]);
|
|
28
|
+
return {
|
|
29
|
+
mutations
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export default useAllMutations;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useState, useRef, useMemo, useCallback } from "react";
|
|
4
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
5
|
+
import { isStorageQuery } from "../utils/storageQueryUtils";
|
|
6
|
+
|
|
7
|
+
// React Query DevTools sorting logic - moved outside component for performance
|
|
8
|
+
|
|
9
|
+
const getStatusRank = q => q.state.fetchStatus !== "idle" ? 0 : !q.getObserversCount() ? 3 : q.isStale() ? 2 : 1;
|
|
10
|
+
const dateSort = (a, b) => a.state.dataUpdatedAt < b.state.dataUpdatedAt ? 1 : -1;
|
|
11
|
+
const statusAndDateSort = (a, b) => {
|
|
12
|
+
if (getStatusRank(a) === getStatusRank(b)) {
|
|
13
|
+
return dateSort(a, b);
|
|
14
|
+
}
|
|
15
|
+
return getStatusRank(a) > getStatusRank(b) ? 1 : -1;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Optimized hook to track all queries with live updates
|
|
20
|
+
* Performance optimizations for mobile:
|
|
21
|
+
* - Filters event types to only relevant ones
|
|
22
|
+
* - Uses lightweight comparison instead of deep equality
|
|
23
|
+
* - Batches updates to reduce re-renders
|
|
24
|
+
* - Memoizes sorted results
|
|
25
|
+
*/
|
|
26
|
+
function useAllQueries() {
|
|
27
|
+
const queryClient = useQueryClient();
|
|
28
|
+
const [queries, setQueries] = useState(() => {
|
|
29
|
+
// Initialize with current queries to avoid flash
|
|
30
|
+
const initial = queryClient.getQueryCache().getAll().filter(query => !isStorageQuery(query.queryKey)).sort(statusAndDateSort);
|
|
31
|
+
return initial;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Track query states using a Map for O(1) lookups
|
|
35
|
+
const queryStatesRef = useRef(new Map());
|
|
36
|
+
const updateTimerRef = useRef(undefined);
|
|
37
|
+
|
|
38
|
+
// Memoized callback to check if queries need update
|
|
39
|
+
const hasQueriesChanged = useCallback(newQueries => {
|
|
40
|
+
const statesMap = queryStatesRef.current;
|
|
41
|
+
|
|
42
|
+
// Quick length check first
|
|
43
|
+
if (newQueries.length !== statesMap.size) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Check if any query state has changed
|
|
48
|
+
for (const query of newQueries) {
|
|
49
|
+
const prevState = statesMap.get(query.queryHash);
|
|
50
|
+
if (!prevState) return true;
|
|
51
|
+
|
|
52
|
+
// Compare only relevant state properties for rendering
|
|
53
|
+
if (prevState.dataUpdatedAt !== query.state.dataUpdatedAt || prevState.errorUpdatedAt !== query.state.errorUpdatedAt || prevState.fetchStatus !== query.state.fetchStatus || prevState.status !== query.state.status || prevState.isInvalidated !== query.state.isInvalidated) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}, []);
|
|
59
|
+
|
|
60
|
+
// Memoized update function
|
|
61
|
+
const updateQueries = useCallback(() => {
|
|
62
|
+
const allQueries = queryClient.getQueryCache().getAll();
|
|
63
|
+
|
|
64
|
+
// Filter out storage queries
|
|
65
|
+
const nonStorageQueries = allQueries.filter(query => !isStorageQuery(query.queryKey));
|
|
66
|
+
|
|
67
|
+
// Check if update is needed
|
|
68
|
+
if (hasQueriesChanged(nonStorageQueries)) {
|
|
69
|
+
// Update states map
|
|
70
|
+
const newStatesMap = new Map();
|
|
71
|
+
nonStorageQueries.forEach(q => {
|
|
72
|
+
newStatesMap.set(q.queryHash, q.state);
|
|
73
|
+
});
|
|
74
|
+
queryStatesRef.current = newStatesMap;
|
|
75
|
+
|
|
76
|
+
// Sort and update
|
|
77
|
+
const sortedQueries = [...nonStorageQueries].sort(statusAndDateSort);
|
|
78
|
+
setQueries(sortedQueries);
|
|
79
|
+
}
|
|
80
|
+
}, [queryClient, hasQueriesChanged]);
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
// Initial update
|
|
83
|
+
updateQueries();
|
|
84
|
+
|
|
85
|
+
// Subscribe with event filtering for performance
|
|
86
|
+
const unsubscribe = queryClient.getQueryCache().subscribe(event => {
|
|
87
|
+
// Only process events that affect query list
|
|
88
|
+
if (event.type === "added" || event.type === "removed" || event.type === "updated") {
|
|
89
|
+
// Skip storage queries
|
|
90
|
+
if ("query" in event && event.query && isStorageQuery(event.query.queryKey)) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Debounce updates to batch rapid changes
|
|
95
|
+
if (updateTimerRef.current) {
|
|
96
|
+
clearTimeout(updateTimerRef.current);
|
|
97
|
+
}
|
|
98
|
+
updateTimerRef.current = setTimeout(() => {
|
|
99
|
+
updateQueries();
|
|
100
|
+
}, 10); // Small delay to batch updates
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
return () => {
|
|
104
|
+
unsubscribe();
|
|
105
|
+
if (updateTimerRef.current) {
|
|
106
|
+
clearTimeout(updateTimerRef.current);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}, [queryClient, updateQueries]);
|
|
110
|
+
|
|
111
|
+
// Memoize the final sorted array to prevent unnecessary re-renders
|
|
112
|
+
return useMemo(() => queries, [queries]);
|
|
113
|
+
}
|
|
114
|
+
export default useAllQueries;
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useState, useEffect } from "react";
|
|
4
|
+
import { useModalPersistence } from "./useModalPersistence";
|
|
5
|
+
import { devToolsStorageKeys } from "@buoy-gg/shared-ui";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Custom hook for managing modal states and related query selection
|
|
9
|
+
* Enhanced with persistence following composition principles
|
|
10
|
+
* Restores modal state on app restart
|
|
11
|
+
*/
|
|
12
|
+
export function useModalManager() {
|
|
13
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
14
|
+
const [isDebugModalOpen, setIsDebugModalOpen] = useState(false);
|
|
15
|
+
const [isEnvModalOpen, setIsEnvModalOpen] = useState(false);
|
|
16
|
+
const [isSentryModalOpen, setIsSentryModalOpen] = useState(false);
|
|
17
|
+
const [isStorageModalOpen, setIsStorageModalOpen] = useState(false);
|
|
18
|
+
const [isNetworkModalOpen, setIsNetworkModalOpen] = useState(false);
|
|
19
|
+
const [selectedQueryKey, setSelectedQueryKey] = useState(undefined);
|
|
20
|
+
const [selectedSection, setSelectedSection] = useState(null);
|
|
21
|
+
const [activeFilter, setActiveFilter] = useState(null);
|
|
22
|
+
const [isStateRestored, setIsStateRestored] = useState(false); // Default to false to prevent clearing state before restoration
|
|
23
|
+
const [activeTab, setActiveTab] = useState("queries");
|
|
24
|
+
const [selectedMutationId, setSelectedMutationId] = useState(undefined);
|
|
25
|
+
|
|
26
|
+
// Persistence hook for saving/loading modal state
|
|
27
|
+
const {
|
|
28
|
+
loadSavedState
|
|
29
|
+
} = useModalPersistence({
|
|
30
|
+
storagePrefix: devToolsStorageKeys.modal.state(),
|
|
31
|
+
isModalOpen,
|
|
32
|
+
isDebugModalOpen,
|
|
33
|
+
isEnvModalOpen,
|
|
34
|
+
isSentryModalOpen,
|
|
35
|
+
isStorageModalOpen,
|
|
36
|
+
isNetworkModalOpen,
|
|
37
|
+
selectedQueryKey,
|
|
38
|
+
selectedSection,
|
|
39
|
+
activeFilter,
|
|
40
|
+
activeTab,
|
|
41
|
+
selectedMutationId,
|
|
42
|
+
isStateRestored
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// Restore saved modal state on component mount
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const restoreState = async () => {
|
|
48
|
+
// Don't set to false again if already restoring
|
|
49
|
+
if (isStateRestored) return;
|
|
50
|
+
try {
|
|
51
|
+
const savedState = await loadSavedState();
|
|
52
|
+
if (savedState) {
|
|
53
|
+
setIsModalOpen(savedState.isModalOpen);
|
|
54
|
+
setIsDebugModalOpen(savedState.isDebugModalOpen);
|
|
55
|
+
setIsEnvModalOpen(savedState.isEnvModalOpen || false);
|
|
56
|
+
setIsSentryModalOpen(savedState.isSentryModalOpen || false);
|
|
57
|
+
setIsStorageModalOpen(savedState.isStorageModalOpen || false);
|
|
58
|
+
setIsNetworkModalOpen(savedState.isNetworkModalOpen || false);
|
|
59
|
+
if (savedState.selectedQueryKey) {
|
|
60
|
+
try {
|
|
61
|
+
const queryKey = JSON.parse(savedState.selectedQueryKey);
|
|
62
|
+
setSelectedQueryKey(queryKey);
|
|
63
|
+
} catch {
|
|
64
|
+
// Silently fail if query key can't be parsed
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (savedState.selectedSection) {
|
|
68
|
+
setSelectedSection(savedState.selectedSection);
|
|
69
|
+
}
|
|
70
|
+
if (savedState.activeFilter) {
|
|
71
|
+
setActiveFilter(savedState.activeFilter);
|
|
72
|
+
}
|
|
73
|
+
if (savedState.activeTab) {
|
|
74
|
+
setActiveTab(savedState.activeTab);
|
|
75
|
+
}
|
|
76
|
+
if (savedState.selectedMutationId) {
|
|
77
|
+
setSelectedMutationId(Number(savedState.selectedMutationId));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
} catch {
|
|
81
|
+
// Silently fail if state can't be restored
|
|
82
|
+
} finally {
|
|
83
|
+
// Mark restoration as complete
|
|
84
|
+
setIsStateRestored(true);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
restoreState();
|
|
88
|
+
}, [isStateRestored, loadSavedState]);
|
|
89
|
+
const handleModalDismiss = () => {
|
|
90
|
+
setIsModalOpen(false);
|
|
91
|
+
setSelectedQueryKey(undefined);
|
|
92
|
+
// Note: Keep activeFilter when dismissing - user might want to maintain filter on next open
|
|
93
|
+
};
|
|
94
|
+
const handleDebugModalDismiss = () => {
|
|
95
|
+
setIsDebugModalOpen(false);
|
|
96
|
+
setSelectedSection(null);
|
|
97
|
+
};
|
|
98
|
+
const handleQuerySelect = query => {
|
|
99
|
+
setSelectedQueryKey(query?.queryKey);
|
|
100
|
+
};
|
|
101
|
+
const handleQueryPress = () => {
|
|
102
|
+
setIsModalOpen(true);
|
|
103
|
+
};
|
|
104
|
+
const handleStatusPress = () => {
|
|
105
|
+
setIsDebugModalOpen(true);
|
|
106
|
+
};
|
|
107
|
+
const handleEnvPress = () => {
|
|
108
|
+
setIsEnvModalOpen(true);
|
|
109
|
+
};
|
|
110
|
+
const handleSentryPress = () => {
|
|
111
|
+
setIsSentryModalOpen(true);
|
|
112
|
+
};
|
|
113
|
+
const handleStoragePress = () => {
|
|
114
|
+
setIsStorageModalOpen(true);
|
|
115
|
+
};
|
|
116
|
+
const handleEnvModalDismiss = () => {
|
|
117
|
+
setIsEnvModalOpen(false);
|
|
118
|
+
};
|
|
119
|
+
const handleSentryModalDismiss = () => {
|
|
120
|
+
setIsSentryModalOpen(false);
|
|
121
|
+
};
|
|
122
|
+
const handleStorageModalDismiss = () => {
|
|
123
|
+
setIsStorageModalOpen(false);
|
|
124
|
+
};
|
|
125
|
+
const handleNetworkPress = () => {
|
|
126
|
+
setIsNetworkModalOpen(true);
|
|
127
|
+
};
|
|
128
|
+
const handleNetworkModalDismiss = () => {
|
|
129
|
+
setIsNetworkModalOpen(false);
|
|
130
|
+
};
|
|
131
|
+
const handleMutationSelect = mutation => {
|
|
132
|
+
setSelectedMutationId(mutation?.mutationId);
|
|
133
|
+
};
|
|
134
|
+
const handleTabChange = newTab => {
|
|
135
|
+
if (newTab !== activeTab) {
|
|
136
|
+
setSelectedQueryKey(undefined);
|
|
137
|
+
setSelectedMutationId(undefined);
|
|
138
|
+
// Reset query status filters when switching tabs (they don't apply to storage)
|
|
139
|
+
setActiveFilter(null);
|
|
140
|
+
}
|
|
141
|
+
setActiveTab(newTab);
|
|
142
|
+
};
|
|
143
|
+
return {
|
|
144
|
+
isModalOpen,
|
|
145
|
+
isDebugModalOpen,
|
|
146
|
+
isEnvModalOpen,
|
|
147
|
+
isSentryModalOpen,
|
|
148
|
+
isStorageModalOpen,
|
|
149
|
+
isNetworkModalOpen,
|
|
150
|
+
selectedQueryKey,
|
|
151
|
+
selectedSection,
|
|
152
|
+
activeFilter,
|
|
153
|
+
isStateRestored,
|
|
154
|
+
activeTab,
|
|
155
|
+
selectedMutationId,
|
|
156
|
+
setSelectedSection,
|
|
157
|
+
setActiveFilter,
|
|
158
|
+
setActiveTab,
|
|
159
|
+
handleModalDismiss,
|
|
160
|
+
handleDebugModalDismiss,
|
|
161
|
+
handleEnvModalDismiss,
|
|
162
|
+
handleSentryModalDismiss,
|
|
163
|
+
handleStorageModalDismiss,
|
|
164
|
+
handleNetworkModalDismiss,
|
|
165
|
+
handleQuerySelect,
|
|
166
|
+
handleQueryPress,
|
|
167
|
+
handleStatusPress,
|
|
168
|
+
handleEnvPress,
|
|
169
|
+
handleSentryPress,
|
|
170
|
+
handleStoragePress,
|
|
171
|
+
handleNetworkPress,
|
|
172
|
+
handleTabChange,
|
|
173
|
+
handleMutationSelect
|
|
174
|
+
};
|
|
175
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useCallback } from "react";
|
|
4
|
+
import { saveModalVisibilityState, loadModalVisibilityState, clearModalVisibilityState } from "../utils/modalStorageOperations";
|
|
5
|
+
/**
|
|
6
|
+
* Hook for persisting modal state following "Extract Reusable Logic" principle
|
|
7
|
+
* Manages saving/loading modal visibility and selection state across app restarts
|
|
8
|
+
*/
|
|
9
|
+
export function useModalPersistence({
|
|
10
|
+
storagePrefix,
|
|
11
|
+
isModalOpen,
|
|
12
|
+
isDebugModalOpen,
|
|
13
|
+
isEnvModalOpen = false,
|
|
14
|
+
isSentryModalOpen = false,
|
|
15
|
+
isStorageModalOpen = false,
|
|
16
|
+
isNetworkModalOpen = false,
|
|
17
|
+
selectedQueryKey,
|
|
18
|
+
selectedSection,
|
|
19
|
+
activeFilter,
|
|
20
|
+
activeTab,
|
|
21
|
+
selectedMutationId,
|
|
22
|
+
isStateRestored
|
|
23
|
+
}) {
|
|
24
|
+
const saveCurrentState = useCallback(async () => {
|
|
25
|
+
const state = {
|
|
26
|
+
isModalOpen,
|
|
27
|
+
isDebugModalOpen,
|
|
28
|
+
isEnvModalOpen,
|
|
29
|
+
isSentryModalOpen,
|
|
30
|
+
isStorageModalOpen,
|
|
31
|
+
isNetworkModalOpen,
|
|
32
|
+
selectedQueryKey: selectedQueryKey ? JSON.stringify(selectedQueryKey) : undefined,
|
|
33
|
+
selectedSection: selectedSection || undefined,
|
|
34
|
+
activeFilter: activeFilter || undefined,
|
|
35
|
+
activeTab: activeTab || undefined,
|
|
36
|
+
selectedMutationId: selectedMutationId?.toString() || undefined
|
|
37
|
+
};
|
|
38
|
+
await saveModalVisibilityState(storagePrefix, state);
|
|
39
|
+
}, [storagePrefix, isModalOpen, isDebugModalOpen, isEnvModalOpen, isSentryModalOpen, isStorageModalOpen, isNetworkModalOpen, selectedQueryKey, selectedSection, activeFilter, activeTab, selectedMutationId]);
|
|
40
|
+
const loadSavedState = useCallback(async () => {
|
|
41
|
+
return await loadModalVisibilityState(storagePrefix);
|
|
42
|
+
}, [storagePrefix]);
|
|
43
|
+
const clearSavedState = useCallback(async () => {
|
|
44
|
+
await clearModalVisibilityState(storagePrefix);
|
|
45
|
+
}, [storagePrefix]);
|
|
46
|
+
|
|
47
|
+
// Auto-save state when modal state changes
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
// Don't persist anything until state restoration is complete to avoid race condition
|
|
50
|
+
if (!isStateRestored) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Only save if a modal is actually open to avoid saving closed state
|
|
55
|
+
if (isModalOpen || isDebugModalOpen || isEnvModalOpen || isSentryModalOpen || isStorageModalOpen || isNetworkModalOpen) {
|
|
56
|
+
saveCurrentState();
|
|
57
|
+
} else {
|
|
58
|
+
// Clear saved state when all modals are closed
|
|
59
|
+
clearSavedState();
|
|
60
|
+
}
|
|
61
|
+
}, [isModalOpen, isDebugModalOpen, isEnvModalOpen, isSentryModalOpen, isStorageModalOpen, isNetworkModalOpen, selectedQueryKey, selectedSection, activeFilter, activeTab, selectedMutationId, isStateRestored, saveCurrentState, clearSavedState]);
|
|
62
|
+
return {
|
|
63
|
+
saveCurrentState,
|
|
64
|
+
loadSavedState,
|
|
65
|
+
clearSavedState
|
|
66
|
+
};
|
|
67
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
5
|
+
/**
|
|
6
|
+
* Supplies action button metadata for a selected mutation. Currently exposes a remove control but
|
|
7
|
+
* centralizes logic so future actions stay consistent across the UI.
|
|
8
|
+
*/
|
|
9
|
+
export function useMutationActionButtons(selectedMutation) {
|
|
10
|
+
const queryClient = useQueryClient();
|
|
11
|
+
return useMemo(() => [{
|
|
12
|
+
label: "Remove",
|
|
13
|
+
bgColorClass: "btnRemove",
|
|
14
|
+
textColorClass: "btnRemove",
|
|
15
|
+
disabled: false,
|
|
16
|
+
onPress: () => queryClient.getMutationCache().remove(selectedMutation)
|
|
17
|
+
}], [selectedMutation, queryClient]);
|
|
18
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
5
|
+
import { getQueryStatusLabel } from "../utils/getQueryStatusLabel";
|
|
6
|
+
/**
|
|
7
|
+
* Tracks how many queries fall into each status bucket (fresh, stale, fetching, etc.). Uses
|
|
8
|
+
* cache subscriptions to stay up to date without polling.
|
|
9
|
+
*/
|
|
10
|
+
function useQueryStatusCounts() {
|
|
11
|
+
const queryClient = useQueryClient();
|
|
12
|
+
const [counts, setCounts] = useState({
|
|
13
|
+
fresh: 0,
|
|
14
|
+
stale: 0,
|
|
15
|
+
fetching: 0,
|
|
16
|
+
paused: 0,
|
|
17
|
+
inactive: 0
|
|
18
|
+
});
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const updateCounts = () => {
|
|
21
|
+
const allQueries = queryClient.getQueryCache().getAll();
|
|
22
|
+
const newCounts = allQueries.reduce((acc, query) => {
|
|
23
|
+
const status = getQueryStatusLabel(query);
|
|
24
|
+
acc[status] = (acc[status] || 0) + 1;
|
|
25
|
+
return acc;
|
|
26
|
+
}, {
|
|
27
|
+
fresh: 0,
|
|
28
|
+
stale: 0,
|
|
29
|
+
fetching: 0,
|
|
30
|
+
paused: 0,
|
|
31
|
+
inactive: 0
|
|
32
|
+
});
|
|
33
|
+
setTimeout(() => setCounts(newCounts), 0);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// Perform an initial update
|
|
37
|
+
updateCounts();
|
|
38
|
+
|
|
39
|
+
// Subscribe to the query cache to run updates on changes
|
|
40
|
+
const unsubscribe = queryClient.getQueryCache().subscribe(updateCounts);
|
|
41
|
+
|
|
42
|
+
// Cleanup the subscription when the component unmounts
|
|
43
|
+
return () => unsubscribe();
|
|
44
|
+
}, [queryClient]);
|
|
45
|
+
return counts;
|
|
46
|
+
}
|
|
47
|
+
export default useQueryStatusCounts;
|
|
48
|
+
|
|
49
|
+
// Mutation status counts hook
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Companion hook for query status counts that groups mutations by status and pause state.
|
|
53
|
+
*/
|
|
54
|
+
export function useMutationStatusCounts() {
|
|
55
|
+
const queryClient = useQueryClient();
|
|
56
|
+
const [counts, setCounts] = useState({
|
|
57
|
+
pending: 0,
|
|
58
|
+
success: 0,
|
|
59
|
+
error: 0,
|
|
60
|
+
paused: 0,
|
|
61
|
+
idle: 0
|
|
62
|
+
});
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
const updateCounts = () => {
|
|
65
|
+
const allMutations = queryClient.getMutationCache().getAll();
|
|
66
|
+
const newCounts = allMutations.reduce((acc, mutation) => {
|
|
67
|
+
const status = mutation.state.status;
|
|
68
|
+
const isPaused = mutation.state.isPaused;
|
|
69
|
+
if (isPaused) {
|
|
70
|
+
acc.paused++;
|
|
71
|
+
} else {
|
|
72
|
+
switch (status) {
|
|
73
|
+
case "idle":
|
|
74
|
+
acc.idle++;
|
|
75
|
+
break;
|
|
76
|
+
case "pending":
|
|
77
|
+
acc.pending++;
|
|
78
|
+
break;
|
|
79
|
+
case "success":
|
|
80
|
+
acc.success++;
|
|
81
|
+
break;
|
|
82
|
+
case "error":
|
|
83
|
+
acc.error++;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return acc;
|
|
88
|
+
}, {
|
|
89
|
+
pending: 0,
|
|
90
|
+
success: 0,
|
|
91
|
+
error: 0,
|
|
92
|
+
paused: 0,
|
|
93
|
+
idle: 0
|
|
94
|
+
});
|
|
95
|
+
setTimeout(() => setCounts(newCounts), 0);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// Perform an initial update
|
|
99
|
+
updateCounts();
|
|
100
|
+
|
|
101
|
+
// Subscribe to the mutation cache to run updates on changes
|
|
102
|
+
const unsubscribe = queryClient.getMutationCache().subscribe(updateCounts);
|
|
103
|
+
|
|
104
|
+
// Cleanup the subscription when the component unmounts
|
|
105
|
+
return () => unsubscribe();
|
|
106
|
+
}, [queryClient]);
|
|
107
|
+
return counts;
|
|
108
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Custom hook for getting React Query state information
|
|
5
|
+
* Separated from UI concerns following composition principles
|
|
6
|
+
*/
|
|
7
|
+
export function useReactQueryState(queryClient) {
|
|
8
|
+
const getReactBuoySubtitle = () => {
|
|
9
|
+
try {
|
|
10
|
+
const allQueries = queryClient.getQueryCache().getAll();
|
|
11
|
+
const allMutations = queryClient.getMutationCache().getAll();
|
|
12
|
+
return `${allQueries.length} queries • ${allMutations.length} mutations`;
|
|
13
|
+
} catch {
|
|
14
|
+
return "Data management & cache inspector";
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
return {
|
|
18
|
+
getReactBuoySubtitle
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Watches the mutation cache for a specific mutation id. Useful when the UI needs to follow
|
|
8
|
+
* mutation lifecycle events (loading, success, error) for a focused inspection panel.
|
|
9
|
+
*/
|
|
10
|
+
export function useGetMutationById(mutationId) {
|
|
11
|
+
const queryClient = useQueryClient();
|
|
12
|
+
const [selectedMutation, setSelectedMutation] = useState(undefined);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const updateSelectedMutation = () => {
|
|
15
|
+
if (mutationId !== undefined) {
|
|
16
|
+
const mutation = queryClient.getMutationCache().getAll().find(m => m.mutationId === mutationId);
|
|
17
|
+
setSelectedMutation(mutation);
|
|
18
|
+
} else {
|
|
19
|
+
setSelectedMutation(undefined);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
setTimeout(updateSelectedMutation, 0);
|
|
23
|
+
const unsubscribe = queryClient.getMutationCache().subscribe(updateSelectedMutation);
|
|
24
|
+
return () => unsubscribe();
|
|
25
|
+
}, [queryClient, mutationId]);
|
|
26
|
+
return selectedMutation;
|
|
27
|
+
}
|