@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,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useModalManager = useModalManager;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _useModalPersistence = require("./useModalPersistence");
|
|
9
|
+
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
10
|
+
/**
|
|
11
|
+
* Custom hook for managing modal states and related query selection
|
|
12
|
+
* Enhanced with persistence following composition principles
|
|
13
|
+
* Restores modal state on app restart
|
|
14
|
+
*/
|
|
15
|
+
function useModalManager() {
|
|
16
|
+
const [isModalOpen, setIsModalOpen] = (0, _react.useState)(false);
|
|
17
|
+
const [isDebugModalOpen, setIsDebugModalOpen] = (0, _react.useState)(false);
|
|
18
|
+
const [isEnvModalOpen, setIsEnvModalOpen] = (0, _react.useState)(false);
|
|
19
|
+
const [isSentryModalOpen, setIsSentryModalOpen] = (0, _react.useState)(false);
|
|
20
|
+
const [isStorageModalOpen, setIsStorageModalOpen] = (0, _react.useState)(false);
|
|
21
|
+
const [isNetworkModalOpen, setIsNetworkModalOpen] = (0, _react.useState)(false);
|
|
22
|
+
const [selectedQueryKey, setSelectedQueryKey] = (0, _react.useState)(undefined);
|
|
23
|
+
const [selectedSection, setSelectedSection] = (0, _react.useState)(null);
|
|
24
|
+
const [activeFilter, setActiveFilter] = (0, _react.useState)(null);
|
|
25
|
+
const [isStateRestored, setIsStateRestored] = (0, _react.useState)(false); // Default to false to prevent clearing state before restoration
|
|
26
|
+
const [activeTab, setActiveTab] = (0, _react.useState)("queries");
|
|
27
|
+
const [selectedMutationId, setSelectedMutationId] = (0, _react.useState)(undefined);
|
|
28
|
+
|
|
29
|
+
// Persistence hook for saving/loading modal state
|
|
30
|
+
const {
|
|
31
|
+
loadSavedState
|
|
32
|
+
} = (0, _useModalPersistence.useModalPersistence)({
|
|
33
|
+
storagePrefix: _sharedUi.devToolsStorageKeys.modal.state(),
|
|
34
|
+
isModalOpen,
|
|
35
|
+
isDebugModalOpen,
|
|
36
|
+
isEnvModalOpen,
|
|
37
|
+
isSentryModalOpen,
|
|
38
|
+
isStorageModalOpen,
|
|
39
|
+
isNetworkModalOpen,
|
|
40
|
+
selectedQueryKey,
|
|
41
|
+
selectedSection,
|
|
42
|
+
activeFilter,
|
|
43
|
+
activeTab,
|
|
44
|
+
selectedMutationId,
|
|
45
|
+
isStateRestored
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Restore saved modal state on component mount
|
|
49
|
+
(0, _react.useEffect)(() => {
|
|
50
|
+
const restoreState = async () => {
|
|
51
|
+
// Don't set to false again if already restoring
|
|
52
|
+
if (isStateRestored) return;
|
|
53
|
+
try {
|
|
54
|
+
const savedState = await loadSavedState();
|
|
55
|
+
if (savedState) {
|
|
56
|
+
setIsModalOpen(savedState.isModalOpen);
|
|
57
|
+
setIsDebugModalOpen(savedState.isDebugModalOpen);
|
|
58
|
+
setIsEnvModalOpen(savedState.isEnvModalOpen || false);
|
|
59
|
+
setIsSentryModalOpen(savedState.isSentryModalOpen || false);
|
|
60
|
+
setIsStorageModalOpen(savedState.isStorageModalOpen || false);
|
|
61
|
+
setIsNetworkModalOpen(savedState.isNetworkModalOpen || false);
|
|
62
|
+
if (savedState.selectedQueryKey) {
|
|
63
|
+
try {
|
|
64
|
+
const queryKey = JSON.parse(savedState.selectedQueryKey);
|
|
65
|
+
setSelectedQueryKey(queryKey);
|
|
66
|
+
} catch {
|
|
67
|
+
// Silently fail if query key can't be parsed
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (savedState.selectedSection) {
|
|
71
|
+
setSelectedSection(savedState.selectedSection);
|
|
72
|
+
}
|
|
73
|
+
if (savedState.activeFilter) {
|
|
74
|
+
setActiveFilter(savedState.activeFilter);
|
|
75
|
+
}
|
|
76
|
+
if (savedState.activeTab) {
|
|
77
|
+
setActiveTab(savedState.activeTab);
|
|
78
|
+
}
|
|
79
|
+
if (savedState.selectedMutationId) {
|
|
80
|
+
setSelectedMutationId(Number(savedState.selectedMutationId));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
} catch {
|
|
84
|
+
// Silently fail if state can't be restored
|
|
85
|
+
} finally {
|
|
86
|
+
// Mark restoration as complete
|
|
87
|
+
setIsStateRestored(true);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
restoreState();
|
|
91
|
+
}, [isStateRestored, loadSavedState]);
|
|
92
|
+
const handleModalDismiss = () => {
|
|
93
|
+
setIsModalOpen(false);
|
|
94
|
+
setSelectedQueryKey(undefined);
|
|
95
|
+
// Note: Keep activeFilter when dismissing - user might want to maintain filter on next open
|
|
96
|
+
};
|
|
97
|
+
const handleDebugModalDismiss = () => {
|
|
98
|
+
setIsDebugModalOpen(false);
|
|
99
|
+
setSelectedSection(null);
|
|
100
|
+
};
|
|
101
|
+
const handleQuerySelect = query => {
|
|
102
|
+
setSelectedQueryKey(query?.queryKey);
|
|
103
|
+
};
|
|
104
|
+
const handleQueryPress = () => {
|
|
105
|
+
setIsModalOpen(true);
|
|
106
|
+
};
|
|
107
|
+
const handleStatusPress = () => {
|
|
108
|
+
setIsDebugModalOpen(true);
|
|
109
|
+
};
|
|
110
|
+
const handleEnvPress = () => {
|
|
111
|
+
setIsEnvModalOpen(true);
|
|
112
|
+
};
|
|
113
|
+
const handleSentryPress = () => {
|
|
114
|
+
setIsSentryModalOpen(true);
|
|
115
|
+
};
|
|
116
|
+
const handleStoragePress = () => {
|
|
117
|
+
setIsStorageModalOpen(true);
|
|
118
|
+
};
|
|
119
|
+
const handleEnvModalDismiss = () => {
|
|
120
|
+
setIsEnvModalOpen(false);
|
|
121
|
+
};
|
|
122
|
+
const handleSentryModalDismiss = () => {
|
|
123
|
+
setIsSentryModalOpen(false);
|
|
124
|
+
};
|
|
125
|
+
const handleStorageModalDismiss = () => {
|
|
126
|
+
setIsStorageModalOpen(false);
|
|
127
|
+
};
|
|
128
|
+
const handleNetworkPress = () => {
|
|
129
|
+
setIsNetworkModalOpen(true);
|
|
130
|
+
};
|
|
131
|
+
const handleNetworkModalDismiss = () => {
|
|
132
|
+
setIsNetworkModalOpen(false);
|
|
133
|
+
};
|
|
134
|
+
const handleMutationSelect = mutation => {
|
|
135
|
+
setSelectedMutationId(mutation?.mutationId);
|
|
136
|
+
};
|
|
137
|
+
const handleTabChange = newTab => {
|
|
138
|
+
if (newTab !== activeTab) {
|
|
139
|
+
setSelectedQueryKey(undefined);
|
|
140
|
+
setSelectedMutationId(undefined);
|
|
141
|
+
// Reset query status filters when switching tabs (they don't apply to storage)
|
|
142
|
+
setActiveFilter(null);
|
|
143
|
+
}
|
|
144
|
+
setActiveTab(newTab);
|
|
145
|
+
};
|
|
146
|
+
return {
|
|
147
|
+
isModalOpen,
|
|
148
|
+
isDebugModalOpen,
|
|
149
|
+
isEnvModalOpen,
|
|
150
|
+
isSentryModalOpen,
|
|
151
|
+
isStorageModalOpen,
|
|
152
|
+
isNetworkModalOpen,
|
|
153
|
+
selectedQueryKey,
|
|
154
|
+
selectedSection,
|
|
155
|
+
activeFilter,
|
|
156
|
+
isStateRestored,
|
|
157
|
+
activeTab,
|
|
158
|
+
selectedMutationId,
|
|
159
|
+
setSelectedSection,
|
|
160
|
+
setActiveFilter,
|
|
161
|
+
setActiveTab,
|
|
162
|
+
handleModalDismiss,
|
|
163
|
+
handleDebugModalDismiss,
|
|
164
|
+
handleEnvModalDismiss,
|
|
165
|
+
handleSentryModalDismiss,
|
|
166
|
+
handleStorageModalDismiss,
|
|
167
|
+
handleNetworkModalDismiss,
|
|
168
|
+
handleQuerySelect,
|
|
169
|
+
handleQueryPress,
|
|
170
|
+
handleStatusPress,
|
|
171
|
+
handleEnvPress,
|
|
172
|
+
handleSentryPress,
|
|
173
|
+
handleStoragePress,
|
|
174
|
+
handleNetworkPress,
|
|
175
|
+
handleTabChange,
|
|
176
|
+
handleMutationSelect
|
|
177
|
+
};
|
|
178
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useModalPersistence = useModalPersistence;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _modalStorageOperations = require("../utils/modalStorageOperations");
|
|
9
|
+
/**
|
|
10
|
+
* Hook for persisting modal state following "Extract Reusable Logic" principle
|
|
11
|
+
* Manages saving/loading modal visibility and selection state across app restarts
|
|
12
|
+
*/
|
|
13
|
+
function useModalPersistence({
|
|
14
|
+
storagePrefix,
|
|
15
|
+
isModalOpen,
|
|
16
|
+
isDebugModalOpen,
|
|
17
|
+
isEnvModalOpen = false,
|
|
18
|
+
isSentryModalOpen = false,
|
|
19
|
+
isStorageModalOpen = false,
|
|
20
|
+
isNetworkModalOpen = false,
|
|
21
|
+
selectedQueryKey,
|
|
22
|
+
selectedSection,
|
|
23
|
+
activeFilter,
|
|
24
|
+
activeTab,
|
|
25
|
+
selectedMutationId,
|
|
26
|
+
isStateRestored
|
|
27
|
+
}) {
|
|
28
|
+
const saveCurrentState = (0, _react.useCallback)(async () => {
|
|
29
|
+
const state = {
|
|
30
|
+
isModalOpen,
|
|
31
|
+
isDebugModalOpen,
|
|
32
|
+
isEnvModalOpen,
|
|
33
|
+
isSentryModalOpen,
|
|
34
|
+
isStorageModalOpen,
|
|
35
|
+
isNetworkModalOpen,
|
|
36
|
+
selectedQueryKey: selectedQueryKey ? JSON.stringify(selectedQueryKey) : undefined,
|
|
37
|
+
selectedSection: selectedSection || undefined,
|
|
38
|
+
activeFilter: activeFilter || undefined,
|
|
39
|
+
activeTab: activeTab || undefined,
|
|
40
|
+
selectedMutationId: selectedMutationId?.toString() || undefined
|
|
41
|
+
};
|
|
42
|
+
await (0, _modalStorageOperations.saveModalVisibilityState)(storagePrefix, state);
|
|
43
|
+
}, [storagePrefix, isModalOpen, isDebugModalOpen, isEnvModalOpen, isSentryModalOpen, isStorageModalOpen, isNetworkModalOpen, selectedQueryKey, selectedSection, activeFilter, activeTab, selectedMutationId]);
|
|
44
|
+
const loadSavedState = (0, _react.useCallback)(async () => {
|
|
45
|
+
return await (0, _modalStorageOperations.loadModalVisibilityState)(storagePrefix);
|
|
46
|
+
}, [storagePrefix]);
|
|
47
|
+
const clearSavedState = (0, _react.useCallback)(async () => {
|
|
48
|
+
await (0, _modalStorageOperations.clearModalVisibilityState)(storagePrefix);
|
|
49
|
+
}, [storagePrefix]);
|
|
50
|
+
|
|
51
|
+
// Auto-save state when modal state changes
|
|
52
|
+
(0, _react.useEffect)(() => {
|
|
53
|
+
// Don't persist anything until state restoration is complete to avoid race condition
|
|
54
|
+
if (!isStateRestored) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Only save if a modal is actually open to avoid saving closed state
|
|
59
|
+
if (isModalOpen || isDebugModalOpen || isEnvModalOpen || isSentryModalOpen || isStorageModalOpen || isNetworkModalOpen) {
|
|
60
|
+
saveCurrentState();
|
|
61
|
+
} else {
|
|
62
|
+
// Clear saved state when all modals are closed
|
|
63
|
+
clearSavedState();
|
|
64
|
+
}
|
|
65
|
+
}, [isModalOpen, isDebugModalOpen, isEnvModalOpen, isSentryModalOpen, isStorageModalOpen, isNetworkModalOpen, selectedQueryKey, selectedSection, activeFilter, activeTab, selectedMutationId, isStateRestored, saveCurrentState, clearSavedState]);
|
|
66
|
+
return {
|
|
67
|
+
saveCurrentState,
|
|
68
|
+
loadSavedState,
|
|
69
|
+
clearSavedState
|
|
70
|
+
};
|
|
71
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useMutationActionButtons = useMutationActionButtons;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactQuery = require("@tanstack/react-query");
|
|
9
|
+
/**
|
|
10
|
+
* Supplies action button metadata for a selected mutation. Currently exposes a remove control but
|
|
11
|
+
* centralizes logic so future actions stay consistent across the UI.
|
|
12
|
+
*/
|
|
13
|
+
function useMutationActionButtons(selectedMutation) {
|
|
14
|
+
const queryClient = (0, _reactQuery.useQueryClient)();
|
|
15
|
+
return (0, _react.useMemo)(() => [{
|
|
16
|
+
label: "Remove",
|
|
17
|
+
bgColorClass: "btnRemove",
|
|
18
|
+
textColorClass: "btnRemove",
|
|
19
|
+
disabled: false,
|
|
20
|
+
onPress: () => queryClient.getMutationCache().remove(selectedMutation)
|
|
21
|
+
}], [selectedMutation, queryClient]);
|
|
22
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
exports.useMutationStatusCounts = useMutationStatusCounts;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _reactQuery = require("@tanstack/react-query");
|
|
10
|
+
var _getQueryStatusLabel = require("../utils/getQueryStatusLabel");
|
|
11
|
+
/**
|
|
12
|
+
* Tracks how many queries fall into each status bucket (fresh, stale, fetching, etc.). Uses
|
|
13
|
+
* cache subscriptions to stay up to date without polling.
|
|
14
|
+
*/
|
|
15
|
+
function useQueryStatusCounts() {
|
|
16
|
+
const queryClient = (0, _reactQuery.useQueryClient)();
|
|
17
|
+
const [counts, setCounts] = (0, _react.useState)({
|
|
18
|
+
fresh: 0,
|
|
19
|
+
stale: 0,
|
|
20
|
+
fetching: 0,
|
|
21
|
+
paused: 0,
|
|
22
|
+
inactive: 0
|
|
23
|
+
});
|
|
24
|
+
(0, _react.useEffect)(() => {
|
|
25
|
+
const updateCounts = () => {
|
|
26
|
+
const allQueries = queryClient.getQueryCache().getAll();
|
|
27
|
+
const newCounts = allQueries.reduce((acc, query) => {
|
|
28
|
+
const status = (0, _getQueryStatusLabel.getQueryStatusLabel)(query);
|
|
29
|
+
acc[status] = (acc[status] || 0) + 1;
|
|
30
|
+
return acc;
|
|
31
|
+
}, {
|
|
32
|
+
fresh: 0,
|
|
33
|
+
stale: 0,
|
|
34
|
+
fetching: 0,
|
|
35
|
+
paused: 0,
|
|
36
|
+
inactive: 0
|
|
37
|
+
});
|
|
38
|
+
setTimeout(() => setCounts(newCounts), 0);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// Perform an initial update
|
|
42
|
+
updateCounts();
|
|
43
|
+
|
|
44
|
+
// Subscribe to the query cache to run updates on changes
|
|
45
|
+
const unsubscribe = queryClient.getQueryCache().subscribe(updateCounts);
|
|
46
|
+
|
|
47
|
+
// Cleanup the subscription when the component unmounts
|
|
48
|
+
return () => unsubscribe();
|
|
49
|
+
}, [queryClient]);
|
|
50
|
+
return counts;
|
|
51
|
+
}
|
|
52
|
+
var _default = exports.default = useQueryStatusCounts; // Mutation status counts hook
|
|
53
|
+
/**
|
|
54
|
+
* Companion hook for query status counts that groups mutations by status and pause state.
|
|
55
|
+
*/
|
|
56
|
+
function useMutationStatusCounts() {
|
|
57
|
+
const queryClient = (0, _reactQuery.useQueryClient)();
|
|
58
|
+
const [counts, setCounts] = (0, _react.useState)({
|
|
59
|
+
pending: 0,
|
|
60
|
+
success: 0,
|
|
61
|
+
error: 0,
|
|
62
|
+
paused: 0,
|
|
63
|
+
idle: 0
|
|
64
|
+
});
|
|
65
|
+
(0, _react.useEffect)(() => {
|
|
66
|
+
const updateCounts = () => {
|
|
67
|
+
const allMutations = queryClient.getMutationCache().getAll();
|
|
68
|
+
const newCounts = allMutations.reduce((acc, mutation) => {
|
|
69
|
+
const status = mutation.state.status;
|
|
70
|
+
const isPaused = mutation.state.isPaused;
|
|
71
|
+
if (isPaused) {
|
|
72
|
+
acc.paused++;
|
|
73
|
+
} else {
|
|
74
|
+
switch (status) {
|
|
75
|
+
case "idle":
|
|
76
|
+
acc.idle++;
|
|
77
|
+
break;
|
|
78
|
+
case "pending":
|
|
79
|
+
acc.pending++;
|
|
80
|
+
break;
|
|
81
|
+
case "success":
|
|
82
|
+
acc.success++;
|
|
83
|
+
break;
|
|
84
|
+
case "error":
|
|
85
|
+
acc.error++;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return acc;
|
|
90
|
+
}, {
|
|
91
|
+
pending: 0,
|
|
92
|
+
success: 0,
|
|
93
|
+
error: 0,
|
|
94
|
+
paused: 0,
|
|
95
|
+
idle: 0
|
|
96
|
+
});
|
|
97
|
+
setTimeout(() => setCounts(newCounts), 0);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// Perform an initial update
|
|
101
|
+
updateCounts();
|
|
102
|
+
|
|
103
|
+
// Subscribe to the mutation cache to run updates on changes
|
|
104
|
+
const unsubscribe = queryClient.getMutationCache().subscribe(updateCounts);
|
|
105
|
+
|
|
106
|
+
// Cleanup the subscription when the component unmounts
|
|
107
|
+
return () => unsubscribe();
|
|
108
|
+
}, [queryClient]);
|
|
109
|
+
return counts;
|
|
110
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useReactQueryState = useReactQueryState;
|
|
7
|
+
/**
|
|
8
|
+
* Custom hook for getting React Query state information
|
|
9
|
+
* Separated from UI concerns following composition principles
|
|
10
|
+
*/
|
|
11
|
+
function useReactQueryState(queryClient) {
|
|
12
|
+
const getReactBuoySubtitle = () => {
|
|
13
|
+
try {
|
|
14
|
+
const allQueries = queryClient.getQueryCache().getAll();
|
|
15
|
+
const allMutations = queryClient.getMutationCache().getAll();
|
|
16
|
+
return `${allQueries.length} queries • ${allMutations.length} mutations`;
|
|
17
|
+
} catch {
|
|
18
|
+
return "Data management & cache inspector";
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
getReactBuoySubtitle
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useGetMutationById = useGetMutationById;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactQuery = require("@tanstack/react-query");
|
|
9
|
+
/**
|
|
10
|
+
* Watches the mutation cache for a specific mutation id. Useful when the UI needs to follow
|
|
11
|
+
* mutation lifecycle events (loading, success, error) for a focused inspection panel.
|
|
12
|
+
*/
|
|
13
|
+
function useGetMutationById(mutationId) {
|
|
14
|
+
const queryClient = (0, _reactQuery.useQueryClient)();
|
|
15
|
+
const [selectedMutation, setSelectedMutation] = (0, _react.useState)(undefined);
|
|
16
|
+
(0, _react.useEffect)(() => {
|
|
17
|
+
const updateSelectedMutation = () => {
|
|
18
|
+
if (mutationId !== undefined) {
|
|
19
|
+
const mutation = queryClient.getMutationCache().getAll().find(m => m.mutationId === mutationId);
|
|
20
|
+
setSelectedMutation(mutation);
|
|
21
|
+
} else {
|
|
22
|
+
setSelectedMutation(undefined);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
setTimeout(updateSelectedMutation, 0);
|
|
26
|
+
const unsubscribe = queryClient.getMutationCache().subscribe(updateSelectedMutation);
|
|
27
|
+
return () => unsubscribe();
|
|
28
|
+
}, [queryClient, mutationId]);
|
|
29
|
+
return selectedMutation;
|
|
30
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useGetQueryByQueryKey = useGetQueryByQueryKey;
|
|
7
|
+
exports.useGetQueryByQueryKeyWithVersion = useGetQueryByQueryKeyWithVersion;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _reactQuery = require("@tanstack/react-query");
|
|
10
|
+
/**
|
|
11
|
+
* Custom hook to track a single query by its queryKey with live updates
|
|
12
|
+
* Optimized to only re-render when the specific query changes
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Returns a single query instance matching the provided key and resubscribes whenever the cache
|
|
17
|
+
* entry changes. Ideal for detail panes where live updates are required without scanning the
|
|
18
|
+
* entire query cache.
|
|
19
|
+
*/
|
|
20
|
+
function useGetQueryByQueryKey(queryKey) {
|
|
21
|
+
const {
|
|
22
|
+
query
|
|
23
|
+
} = useGetQueryByQueryKeyWithVersion(queryKey);
|
|
24
|
+
return query;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Returns a single query instance with a version number that increments on each cache update.
|
|
29
|
+
* Use the version as a dependency or key to ensure child components re-render when query state changes.
|
|
30
|
+
*
|
|
31
|
+
* This is necessary because React Query mutates the Query object in place, so React's
|
|
32
|
+
* shallow comparison won't detect changes to nested properties like query.state.status.
|
|
33
|
+
*/
|
|
34
|
+
function useGetQueryByQueryKeyWithVersion(queryKey) {
|
|
35
|
+
const queryClient = (0, _reactQuery.useQueryClient)();
|
|
36
|
+
const [queryState, setQueryState] = (0, _react.useState)({
|
|
37
|
+
query: undefined,
|
|
38
|
+
version: 0
|
|
39
|
+
});
|
|
40
|
+
const queryHashRef = (0, _react.useRef)(undefined);
|
|
41
|
+
(0, _react.useEffect)(() => {
|
|
42
|
+
if (!queryKey) {
|
|
43
|
+
setQueryState({
|
|
44
|
+
query: undefined,
|
|
45
|
+
version: 0
|
|
46
|
+
});
|
|
47
|
+
queryHashRef.current = undefined;
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Get initial query state
|
|
52
|
+
const query = queryClient.getQueryCache().find({
|
|
53
|
+
queryKey,
|
|
54
|
+
exact: true
|
|
55
|
+
});
|
|
56
|
+
setQueryState({
|
|
57
|
+
query,
|
|
58
|
+
version: 0
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// Store the stringified queryKey for comparison
|
|
62
|
+
const queryKeyString = JSON.stringify(queryKey);
|
|
63
|
+
queryHashRef.current = queryKeyString;
|
|
64
|
+
|
|
65
|
+
// Subscribe to query cache changes but only update if our specific query changed
|
|
66
|
+
const unsubscribe = queryClient.getQueryCache().subscribe(event => {
|
|
67
|
+
// Only process events for our specific query
|
|
68
|
+
if (event.type === "updated" || event.type === "added" || event.type === "removed") {
|
|
69
|
+
if ("query" in event && event.query) {
|
|
70
|
+
// Check if the event is for our query by comparing the stringified keys
|
|
71
|
+
const eventQueryKeyString = JSON.stringify(event.query.queryKey);
|
|
72
|
+
const isOurQuery = eventQueryKeyString === queryHashRef.current;
|
|
73
|
+
if (isOurQuery) {
|
|
74
|
+
if (event.type === "removed") {
|
|
75
|
+
setQueryState({
|
|
76
|
+
query: undefined,
|
|
77
|
+
version: 0
|
|
78
|
+
});
|
|
79
|
+
} else {
|
|
80
|
+
// For 'updated' and 'added' events, use the query from the event
|
|
81
|
+
// Update both the query and increment version to force re-renders
|
|
82
|
+
setQueryState(prev => ({
|
|
83
|
+
query: event.query,
|
|
84
|
+
version: prev.version + 1
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// Cleanup subscription when component unmounts
|
|
93
|
+
return () => unsubscribe();
|
|
94
|
+
}, [queryClient, queryKey]);
|
|
95
|
+
return queryState;
|
|
96
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useStorageQueryCounts = useStorageQueryCounts;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactQuery = require("@tanstack/react-query");
|
|
9
|
+
var _getStorageQueryCounts = require("../utils/getStorageQueryCounts");
|
|
10
|
+
/**
|
|
11
|
+
* Hook to get storage query counts with proper memoization
|
|
12
|
+
* Following rule3 - Component Composition principles:
|
|
13
|
+
* - Extract Reusable Logic: Dedicated hook for storage counting
|
|
14
|
+
* - Rigor and Justification: Proper memoization only where proven necessary
|
|
15
|
+
* - Stable references: useMemo with correct dependencies to prevent infinite loops
|
|
16
|
+
*/
|
|
17
|
+
function useStorageQueryCounts() {
|
|
18
|
+
const queryClient = (0, _reactQuery.useQueryClient)();
|
|
19
|
+
|
|
20
|
+
// Memoize counts based on query cache state changes
|
|
21
|
+
// This prevents infinite re-renders by stabilizing the counts object
|
|
22
|
+
const counts = (0, _react.useMemo)(() => {
|
|
23
|
+
const allQueries = queryClient.getQueryCache().getAll();
|
|
24
|
+
return (0, _getStorageQueryCounts.getStorageQueryCounts)(allQueries);
|
|
25
|
+
}, [queryClient]); // Depend on queryClient, not the result of getAll()
|
|
26
|
+
|
|
27
|
+
return counts;
|
|
28
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useWifiState = useWifiState;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactQuery = require("@tanstack/react-query");
|
|
9
|
+
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
10
|
+
/**
|
|
11
|
+
* Synchronizes a local Wi-Fi toggle with React Query’s `onlineManager`, persisting the selection
|
|
12
|
+
* so developers can simulate offline mode across reloads.
|
|
13
|
+
*/
|
|
14
|
+
function useWifiState() {
|
|
15
|
+
const [isOnline, setIsOnline] = (0, _react.useState)(() => _reactQuery.onlineManager.isOnline());
|
|
16
|
+
const hasLoadedPersistedState = (0, _react.useRef)(false);
|
|
17
|
+
|
|
18
|
+
// Load persisted WiFi state on mount
|
|
19
|
+
(0, _react.useEffect)(() => {
|
|
20
|
+
if (hasLoadedPersistedState.current) return;
|
|
21
|
+
const loadPersistedState = async () => {
|
|
22
|
+
try {
|
|
23
|
+
const savedState = await (0, _sharedUi.safeGetItem)(_sharedUi.devToolsStorageKeys.settings.wifiEnabled());
|
|
24
|
+
if (savedState !== null) {
|
|
25
|
+
const isEnabled = savedState === "true";
|
|
26
|
+
setIsOnline(isEnabled);
|
|
27
|
+
_reactQuery.onlineManager.setOnline(isEnabled);
|
|
28
|
+
}
|
|
29
|
+
hasLoadedPersistedState.current = true;
|
|
30
|
+
} catch (error) {
|
|
31
|
+
// Failed to load WiFi state
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
loadPersistedState();
|
|
35
|
+
}, []);
|
|
36
|
+
|
|
37
|
+
// Save WiFi state when it changes
|
|
38
|
+
const saveWifiState = async enabled => {
|
|
39
|
+
try {
|
|
40
|
+
await (0, _sharedUi.safeSetItem)(_sharedUi.devToolsStorageKeys.settings.wifiEnabled(), enabled.toString());
|
|
41
|
+
} catch (error) {
|
|
42
|
+
// Failed to save WiFi state
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const handleWifiToggle = () => {
|
|
46
|
+
const newOnlineState = !isOnline;
|
|
47
|
+
setIsOnline(newOnlineState);
|
|
48
|
+
_reactQuery.onlineManager.setOnline(newOnlineState);
|
|
49
|
+
saveWifiState(newOnlineState);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// Listen to online manager changes to keep state in sync
|
|
53
|
+
(0, _react.useEffect)(() => {
|
|
54
|
+
const unsubscribe = _reactQuery.onlineManager.subscribe(online => {
|
|
55
|
+
setIsOnline(online);
|
|
56
|
+
// Only save if we've already loaded the persisted state to avoid overwriting on mount
|
|
57
|
+
if (hasLoadedPersistedState.current) {
|
|
58
|
+
saveWifiState(online);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return unsubscribe;
|
|
62
|
+
}, []);
|
|
63
|
+
return {
|
|
64
|
+
isOnline,
|
|
65
|
+
handleWifiToggle
|
|
66
|
+
};
|
|
67
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _ReactQueryDevTools = require("./ReactQueryDevTools");
|
|
7
|
+
Object.keys(_ReactQueryDevTools).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _ReactQueryDevTools[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _ReactQueryDevTools[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _types = require("./types");
|
|
7
|
+
Object.keys(_types).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _types[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isPlainObject = isPlainObject;
|
|
7
|
+
// Shared type definitions for the dev tools
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Type guard that narrows a value to a plain object (excluding arrays, Dates, Maps, etc.).
|
|
11
|
+
*/
|
|
12
|
+
function isPlainObject(value) {
|
|
13
|
+
return value !== null && value !== undefined && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date) && !(value instanceof Error) && !(value instanceof Map) && !(value instanceof Set) && !(value instanceof RegExp) && typeof value !== "function";
|
|
14
|
+
}
|