@buoy-gg/react-query 1.7.8 → 2.1.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/lib/commonjs/index.js +619 -24
- package/lib/commonjs/preset.js +1 -1
- package/lib/commonjs/react-query/components/DataEditorMode.js +9 -16
- package/lib/commonjs/react-query/components/MutationEditorMode.js +1 -3
- package/lib/commonjs/react-query/components/ReactQueryDevToolsModal.js +12 -0
- package/lib/commonjs/react-query/components/modals/MutationBrowserModal.js +2 -1
- package/lib/commonjs/react-query/components/modals/QueryBrowserModal.js +8 -14
- package/lib/commonjs/react-query/components/query-browser/ActionButton.js +40 -69
- package/lib/commonjs/react-query/components/query-browser/QueryActions.js +70 -84
- package/lib/commonjs/react-query/hooks/useActionButtons.js +7 -15
- package/lib/commonjs/react-query/hooks/useAllMutations.js +65 -15
- package/lib/commonjs/react-query/hooks/useMutationActionButtons.js +1 -2
- package/lib/commonjs/react-query/hooks/useWifiState.js +3 -3
- package/lib/commonjs/react-query/index.js +11 -0
- package/lib/commonjs/react-query/stores/index.js +48 -0
- package/lib/commonjs/react-query/stores/reactQueryEventStore.js +311 -0
- package/lib/commonjs/react-query/utils/modalStorageOperations.js +2 -2
- package/lib/module/index.js +113 -8
- package/lib/module/preset.js +2 -2
- package/lib/module/react-query/components/DataEditorMode.js +9 -16
- package/lib/module/react-query/components/MutationEditorMode.js +1 -3
- package/lib/module/react-query/components/ReactQueryDevToolsModal.js +13 -1
- package/lib/module/react-query/components/modals/MutationBrowserModal.js +2 -1
- package/lib/module/react-query/components/modals/QueryBrowserModal.js +9 -15
- package/lib/module/react-query/components/query-browser/ActionButton.js +40 -70
- package/lib/module/react-query/components/query-browser/QueryActions.js +70 -84
- package/lib/module/react-query/hooks/useActionButtons.js +7 -15
- package/lib/module/react-query/hooks/useAllMutations.js +66 -16
- package/lib/module/react-query/hooks/useMutationActionButtons.js +1 -2
- package/lib/module/react-query/hooks/useWifiState.js +4 -4
- package/lib/module/react-query/index.js +2 -1
- package/lib/module/react-query/stores/index.js +3 -0
- package/lib/module/react-query/stores/reactQueryEventStore.js +302 -0
- package/lib/module/react-query/utils/modalStorageOperations.js +3 -3
- package/lib/typescript/index.d.ts +61 -5
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/react-query/components/DataEditorMode.d.ts.map +1 -1
- package/lib/typescript/react-query/components/MutationEditorMode.d.ts.map +1 -1
- package/lib/typescript/react-query/components/ReactQueryDevToolsModal.d.ts.map +1 -1
- package/lib/typescript/react-query/components/modals/MutationBrowserModal.d.ts.map +1 -1
- package/lib/typescript/react-query/components/modals/QueryBrowserModal.d.ts.map +1 -1
- package/lib/typescript/react-query/components/query-browser/ActionButton.d.ts +4 -42
- package/lib/typescript/react-query/components/query-browser/ActionButton.d.ts.map +1 -1
- package/lib/typescript/react-query/components/query-browser/QueryActions.d.ts.map +1 -1
- package/lib/typescript/react-query/hooks/useActionButtons.d.ts +5 -8
- package/lib/typescript/react-query/hooks/useActionButtons.d.ts.map +1 -1
- package/lib/typescript/react-query/hooks/useAllMutations.d.ts +2 -2
- package/lib/typescript/react-query/hooks/useAllMutations.d.ts.map +1 -1
- package/lib/typescript/react-query/hooks/useMutationActionButtons.d.ts +1 -8
- package/lib/typescript/react-query/hooks/useMutationActionButtons.d.ts.map +1 -1
- package/lib/typescript/react-query/hooks/useWifiState.d.ts +1 -1
- package/lib/typescript/react-query/hooks/useWifiState.d.ts.map +1 -1
- package/lib/typescript/react-query/index.d.ts +1 -0
- package/lib/typescript/react-query/index.d.ts.map +1 -1
- package/lib/typescript/react-query/stores/index.d.ts +2 -0
- package/lib/typescript/react-query/stores/index.d.ts.map +1 -0
- package/lib/typescript/react-query/stores/reactQueryEventStore.d.ts +99 -0
- package/lib/typescript/react-query/stores/reactQueryEventStore.d.ts.map +1 -0
- package/package.json +17 -3
|
@@ -74,13 +74,11 @@ export function DataEditorMode({
|
|
|
74
74
|
paddingBottom: isFloatingMode ? 0 : insets.bottom + 8
|
|
75
75
|
}],
|
|
76
76
|
children: /*#__PURE__*/_jsx(View, {
|
|
77
|
-
style: styles.
|
|
77
|
+
style: styles.actionsRow,
|
|
78
78
|
children: actionButtons.map((action, index) => /*#__PURE__*/_jsx(ActionButton, {
|
|
79
|
-
"sentry-label": `ignore action button ${action.label}`,
|
|
80
79
|
onClick: action.onPress,
|
|
81
80
|
text: action.label,
|
|
82
|
-
|
|
83
|
-
_textColorClass: action.textColorClass,
|
|
81
|
+
variant: action.variant,
|
|
84
82
|
disabled: action.disabled
|
|
85
83
|
}, index))
|
|
86
84
|
})
|
|
@@ -108,13 +106,11 @@ export function DataEditorActionsFooter({
|
|
|
108
106
|
paddingBottom: isFloatingMode ? 0 : insets.bottom + 8
|
|
109
107
|
}],
|
|
110
108
|
children: /*#__PURE__*/_jsx(View, {
|
|
111
|
-
style: styles.
|
|
109
|
+
style: styles.actionsRow,
|
|
112
110
|
children: actionButtons.map((action, index) => /*#__PURE__*/_jsx(ActionButton, {
|
|
113
|
-
"sentry-label": `ignore action button ${action.label}`,
|
|
114
111
|
onClick: action.onPress,
|
|
115
112
|
text: action.label,
|
|
116
|
-
|
|
117
|
-
_textColorClass: action.textColorClass,
|
|
113
|
+
variant: action.variant,
|
|
118
114
|
disabled: action.disabled
|
|
119
115
|
}, index))
|
|
120
116
|
})
|
|
@@ -224,23 +220,20 @@ const styles = StyleSheet.create({
|
|
|
224
220
|
lineHeight: 20,
|
|
225
221
|
maxWidth: 280
|
|
226
222
|
},
|
|
227
|
-
// Action footer
|
|
223
|
+
// Action footer - compact single row layout
|
|
228
224
|
actionFooter: {
|
|
229
225
|
borderTopWidth: 1,
|
|
230
226
|
borderTopColor: buoyColors.border,
|
|
231
|
-
paddingTop:
|
|
227
|
+
paddingTop: 8,
|
|
232
228
|
paddingHorizontal: 12,
|
|
233
229
|
backgroundColor: buoyColors.base,
|
|
234
230
|
borderBottomLeftRadius: 14,
|
|
235
231
|
borderBottomRightRadius: 14
|
|
236
232
|
},
|
|
237
|
-
|
|
233
|
+
actionsRow: {
|
|
238
234
|
flexDirection: "row",
|
|
239
|
-
|
|
240
|
-
gap:
|
|
241
|
-
// Reduced from 8
|
|
242
|
-
justifyContent: "space-between",
|
|
243
|
-
paddingBottom: 2
|
|
235
|
+
alignItems: "center",
|
|
236
|
+
gap: 8
|
|
244
237
|
},
|
|
245
238
|
// Query Explorer styled container matching QueryDetails
|
|
246
239
|
queryExplorerContainer: {
|
|
@@ -68,11 +68,9 @@ export function MutationEditorMode({
|
|
|
68
68
|
children: /*#__PURE__*/_jsx(View, {
|
|
69
69
|
style: styles.actionsGrid,
|
|
70
70
|
children: actionButtons.map((action, index) => /*#__PURE__*/_jsx(ActionButton, {
|
|
71
|
-
"sentry-label": `ignore action button ${action.label}`,
|
|
72
71
|
onClick: action.onPress,
|
|
73
72
|
text: action.label,
|
|
74
|
-
|
|
75
|
-
_textColorClass: action.textColorClass,
|
|
73
|
+
variant: action.variant,
|
|
76
74
|
disabled: action.disabled
|
|
77
75
|
}, index))
|
|
78
76
|
})
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { useCallback, useState } from "react";
|
|
3
|
+
import { useCallback, useState, useEffect } from "react";
|
|
4
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
4
5
|
import { ReactQueryModal } from "./modals/ReactQueryModal";
|
|
6
|
+
import { reactQueryEventStore } from "../stores/reactQueryEventStore";
|
|
5
7
|
|
|
6
8
|
/** Configuration options for the high-level React Query dev tools modal wrapper. */
|
|
7
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -15,6 +17,16 @@ export function ReactQueryDevToolsModal({
|
|
|
15
17
|
onMinimize,
|
|
16
18
|
enableSharedModalDimensions = true
|
|
17
19
|
}) {
|
|
20
|
+
// Get QueryClient and connect to event store for unified Events DevTools
|
|
21
|
+
const queryClient = useQueryClient();
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
// Connect the QueryClient to the event store so events flow to unified Events DevTools
|
|
24
|
+
// Only connect if not already connected (to preserve connection across modal open/close)
|
|
25
|
+
if (!reactQueryEventStore.isConnected()) {
|
|
26
|
+
reactQueryEventStore.setQueryClient(queryClient);
|
|
27
|
+
}
|
|
28
|
+
// Don't disconnect on unmount - keep the connection for unified Events DevTools
|
|
29
|
+
}, [queryClient]);
|
|
18
30
|
const [selectedQueryKey, setSelectedQueryKey] = useState(undefined);
|
|
19
31
|
const [selectedMutationId, setSelectedMutationId] = useState(undefined);
|
|
20
32
|
const [activeFilter, setActiveFilter] = useState(null);
|
|
@@ -37,7 +37,8 @@ export function MutationBrowserModal({
|
|
|
37
37
|
// Clear mutation cache handler
|
|
38
38
|
const handleClearCache = useCallback(() => {
|
|
39
39
|
queryClient.getMutationCache().clear();
|
|
40
|
-
|
|
40
|
+
onMutationSelect(undefined);
|
|
41
|
+
}, [queryClient, onMutationSelect]);
|
|
41
42
|
|
|
42
43
|
// Track modal mode for conditional styling
|
|
43
44
|
// Initialize with bottomSheet but it will be updated from persisted state if available
|
|
@@ -9,7 +9,7 @@ import { QueryBrowserFooter } from "./QueryBrowserFooter";
|
|
|
9
9
|
import { QueryFilterViewV3 } from "../QueryFilterViewV3";
|
|
10
10
|
import { useState, useCallback, useEffect } from "react";
|
|
11
11
|
import { View, StyleSheet } from "react-native";
|
|
12
|
-
import { devToolsStorageKeys,
|
|
12
|
+
import { devToolsStorageKeys, persistentStorage, buoyColors } from "@buoy-gg/shared-ui";
|
|
13
13
|
import useAllQueries from "../../hooks/useAllQueries";
|
|
14
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
15
|
/**
|
|
@@ -48,17 +48,11 @@ export function QueryBrowserModal({
|
|
|
48
48
|
const [ignoredPatterns, setIgnoredPatterns] = useState(new Set());
|
|
49
49
|
const [includedPatterns, setIncludedPatterns] = useState(new Set());
|
|
50
50
|
|
|
51
|
-
// AsyncStorage for persisting ignored patterns
|
|
52
|
-
const {
|
|
53
|
-
getItem: safeGetItem,
|
|
54
|
-
setItem: safeSetItem
|
|
55
|
-
} = useSafeAsyncStorage();
|
|
56
|
-
|
|
57
51
|
// Load ignored patterns from storage on mount
|
|
58
52
|
useEffect(() => {
|
|
59
53
|
const loadFilters = async () => {
|
|
60
54
|
try {
|
|
61
|
-
const stored = await
|
|
55
|
+
const stored = await persistentStorage.getItem(devToolsStorageKeys.reactQuery.ignoredPatterns());
|
|
62
56
|
if (stored) {
|
|
63
57
|
const patterns = JSON.parse(stored);
|
|
64
58
|
if (Array.isArray(patterns)) {
|
|
@@ -70,13 +64,13 @@ export function QueryBrowserModal({
|
|
|
70
64
|
}
|
|
71
65
|
};
|
|
72
66
|
loadFilters();
|
|
73
|
-
}, [
|
|
67
|
+
}, []);
|
|
74
68
|
|
|
75
69
|
// Load included patterns from storage on mount
|
|
76
70
|
useEffect(() => {
|
|
77
71
|
const loadFilters = async () => {
|
|
78
72
|
try {
|
|
79
|
-
const stored = await
|
|
73
|
+
const stored = await persistentStorage.getItem(devToolsStorageKeys.reactQuery.includedPatterns());
|
|
80
74
|
if (stored) {
|
|
81
75
|
const patterns = JSON.parse(stored);
|
|
82
76
|
if (Array.isArray(patterns)) {
|
|
@@ -88,33 +82,33 @@ export function QueryBrowserModal({
|
|
|
88
82
|
}
|
|
89
83
|
};
|
|
90
84
|
loadFilters();
|
|
91
|
-
}, [
|
|
85
|
+
}, []);
|
|
92
86
|
|
|
93
87
|
// Save ignored patterns to storage when they change
|
|
94
88
|
useEffect(() => {
|
|
95
89
|
const saveFilters = async () => {
|
|
96
90
|
try {
|
|
97
91
|
const patterns = Array.from(ignoredPatterns);
|
|
98
|
-
await
|
|
92
|
+
await persistentStorage.setItem(devToolsStorageKeys.reactQuery.ignoredPatterns(), JSON.stringify(patterns));
|
|
99
93
|
} catch (error) {
|
|
100
94
|
console.error("Failed to save ignored patterns:", error);
|
|
101
95
|
}
|
|
102
96
|
};
|
|
103
97
|
saveFilters();
|
|
104
|
-
}, [ignoredPatterns
|
|
98
|
+
}, [ignoredPatterns]);
|
|
105
99
|
|
|
106
100
|
// Save included patterns to storage when they change
|
|
107
101
|
useEffect(() => {
|
|
108
102
|
const saveFilters = async () => {
|
|
109
103
|
try {
|
|
110
104
|
const patterns = Array.from(includedPatterns);
|
|
111
|
-
await
|
|
105
|
+
await persistentStorage.setItem(devToolsStorageKeys.reactQuery.includedPatterns(), JSON.stringify(patterns));
|
|
112
106
|
} catch (error) {
|
|
113
107
|
console.error("Failed to save included patterns:", error);
|
|
114
108
|
}
|
|
115
109
|
};
|
|
116
110
|
saveFilters();
|
|
117
|
-
}, [includedPatterns
|
|
111
|
+
}, [includedPatterns]);
|
|
118
112
|
|
|
119
113
|
// Toggle pattern in ignored set
|
|
120
114
|
const handlePatternToggle = useCallback(pattern => {
|
|
@@ -2,65 +2,55 @@
|
|
|
2
2
|
|
|
3
3
|
import { TouchableOpacity, Text, View, StyleSheet } from "react-native";
|
|
4
4
|
import { buoyColors } from "@buoy-gg/shared-ui";
|
|
5
|
-
|
|
6
|
-
// Define the color mappings using Buoy theme colors
|
|
7
5
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
// Clean, minimal color config matching React Query DevTools style
|
|
8
7
|
const buttonConfigs = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
borderColor: buoyColors.
|
|
13
|
-
textColor: buoyColors.success
|
|
8
|
+
refetch: {
|
|
9
|
+
dotColor: buoyColors.success,
|
|
10
|
+
textColor: buoyColors.text,
|
|
11
|
+
borderColor: buoyColors.border
|
|
14
12
|
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
borderColor: buoyColors.
|
|
19
|
-
textColor: buoyColors.warning
|
|
13
|
+
invalidate: {
|
|
14
|
+
dotColor: buoyColors.warning,
|
|
15
|
+
textColor: buoyColors.text,
|
|
16
|
+
borderColor: buoyColors.border
|
|
20
17
|
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
borderColor: buoyColors.
|
|
25
|
-
textColor: buoyColors.textSecondary
|
|
18
|
+
reset: {
|
|
19
|
+
dotColor: buoyColors.textSecondary,
|
|
20
|
+
textColor: buoyColors.text,
|
|
21
|
+
borderColor: buoyColors.border
|
|
26
22
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
borderColor: buoyColors.error + "40"
|
|
31
|
-
textColor: buoyColors.error
|
|
23
|
+
remove: {
|
|
24
|
+
dotColor: buoyColors.error,
|
|
25
|
+
textColor: buoyColors.error,
|
|
26
|
+
borderColor: buoyColors.error + "40"
|
|
32
27
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
borderColor: buoyColors.
|
|
37
|
-
textColor: buoyColors.primary
|
|
28
|
+
triggerLoading: {
|
|
29
|
+
dotColor: buoyColors.info,
|
|
30
|
+
textColor: buoyColors.info,
|
|
31
|
+
borderColor: buoyColors.info + "40"
|
|
38
32
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
borderColor: buoyColors.
|
|
43
|
-
textColor: buoyColors.textMuted
|
|
33
|
+
triggerError: {
|
|
34
|
+
dotColor: buoyColors.error,
|
|
35
|
+
textColor: buoyColors.error,
|
|
36
|
+
borderColor: buoyColors.error + "40"
|
|
44
37
|
}
|
|
45
38
|
};
|
|
46
|
-
/**
|
|
39
|
+
/** Clean, minimal action button matching React Query DevTools style. */
|
|
47
40
|
export default function ActionButton({
|
|
48
41
|
onClick,
|
|
49
42
|
text,
|
|
50
|
-
|
|
51
|
-
bgColorClass,
|
|
43
|
+
variant,
|
|
52
44
|
disabled
|
|
53
45
|
}) {
|
|
54
|
-
|
|
55
|
-
const config = buttonConfigs[bgColorClass];
|
|
46
|
+
const config = buttonConfigs[variant];
|
|
56
47
|
return /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
57
48
|
"sentry-label": "ignore devtools action button",
|
|
58
49
|
disabled: disabled,
|
|
59
50
|
onPress: onClick,
|
|
60
51
|
style: [styles.button, {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
opacity: disabled ? 0.5 : 1
|
|
52
|
+
borderColor: disabled ? buoyColors.border : config.borderColor,
|
|
53
|
+
opacity: disabled ? 0.4 : 1
|
|
64
54
|
}],
|
|
65
55
|
activeOpacity: 0.7,
|
|
66
56
|
accessibilityRole: "button",
|
|
@@ -70,7 +60,7 @@ export default function ActionButton({
|
|
|
70
60
|
},
|
|
71
61
|
children: [/*#__PURE__*/_jsx(View, {
|
|
72
62
|
style: [styles.dot, {
|
|
73
|
-
backgroundColor: disabled ? buoyColors.textMuted : config.
|
|
63
|
+
backgroundColor: disabled ? buoyColors.textMuted : config.dotColor
|
|
74
64
|
}]
|
|
75
65
|
}), /*#__PURE__*/_jsx(Text, {
|
|
76
66
|
style: [styles.text, {
|
|
@@ -85,40 +75,20 @@ const styles = StyleSheet.create({
|
|
|
85
75
|
flexDirection: "row",
|
|
86
76
|
alignItems: "center",
|
|
87
77
|
justifyContent: "center",
|
|
88
|
-
borderRadius:
|
|
89
|
-
// rectangular button shape
|
|
78
|
+
borderRadius: 4,
|
|
90
79
|
borderWidth: 1,
|
|
91
|
-
paddingHorizontal:
|
|
92
|
-
paddingVertical:
|
|
93
|
-
|
|
94
|
-
minWidth: 80,
|
|
95
|
-
shadowOffset: {
|
|
96
|
-
width: 0,
|
|
97
|
-
height: 1
|
|
98
|
-
},
|
|
99
|
-
shadowOpacity: 0.2,
|
|
100
|
-
shadowRadius: 2,
|
|
101
|
-
elevation: 2
|
|
80
|
+
paddingHorizontal: 8,
|
|
81
|
+
paddingVertical: 4,
|
|
82
|
+
backgroundColor: "transparent"
|
|
102
83
|
},
|
|
103
84
|
dot: {
|
|
104
|
-
width:
|
|
105
|
-
height:
|
|
85
|
+
width: 6,
|
|
86
|
+
height: 6,
|
|
106
87
|
borderRadius: 3,
|
|
107
|
-
marginRight: 6
|
|
108
|
-
shadowColor: buoyColors.text,
|
|
109
|
-
shadowOffset: {
|
|
110
|
-
width: 0,
|
|
111
|
-
height: 0
|
|
112
|
-
},
|
|
113
|
-
shadowOpacity: 0.6,
|
|
114
|
-
shadowRadius: 2
|
|
88
|
+
marginRight: 6
|
|
115
89
|
},
|
|
116
90
|
text: {
|
|
117
|
-
fontSize:
|
|
118
|
-
fontWeight: "
|
|
119
|
-
letterSpacing: 0.5,
|
|
120
|
-
textTransform: "uppercase",
|
|
121
|
-
fontFamily: "monospace",
|
|
122
|
-
height: 12
|
|
91
|
+
fontSize: 12,
|
|
92
|
+
fontWeight: "500"
|
|
123
93
|
}
|
|
124
94
|
});
|
|
@@ -24,108 +24,94 @@ export default function QueryActions({
|
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
26
26
|
const queryStatus = query.state.status;
|
|
27
|
+
const isFetching = getQueryStatusLabel(query) === "fetching";
|
|
27
28
|
return /*#__PURE__*/_jsxs(View, {
|
|
28
29
|
style: styles.container,
|
|
29
|
-
children: [/*#__PURE__*/
|
|
30
|
-
style: styles.
|
|
31
|
-
children:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
refetch({
|
|
30
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
31
|
+
style: styles.section,
|
|
32
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
33
|
+
style: styles.sectionLabel,
|
|
34
|
+
children: "Actions"
|
|
35
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
36
|
+
style: styles.buttonsRow,
|
|
37
|
+
children: [/*#__PURE__*/_jsx(ActionButton, {
|
|
38
|
+
disabled: isFetching,
|
|
39
|
+
onClick: () => refetch({
|
|
39
40
|
query
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"sentry-label": "ignore devtools query invalidate action",
|
|
47
|
-
disabled: queryStatus === "pending",
|
|
48
|
-
onClick: () => {
|
|
49
|
-
invalidate({
|
|
41
|
+
}),
|
|
42
|
+
variant: "refetch",
|
|
43
|
+
text: "Refetch"
|
|
44
|
+
}), /*#__PURE__*/_jsx(ActionButton, {
|
|
45
|
+
disabled: queryStatus === "pending",
|
|
46
|
+
onClick: () => invalidate({
|
|
50
47
|
query,
|
|
51
48
|
queryClient
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"sentry-label": "ignore devtools query reset action",
|
|
59
|
-
disabled: queryStatus === "pending",
|
|
60
|
-
onClick: () => {
|
|
61
|
-
reset({
|
|
62
|
-
queryClient,
|
|
63
|
-
query
|
|
64
|
-
});
|
|
65
|
-
},
|
|
66
|
-
bgColorClass: "btnReset",
|
|
67
|
-
text: "Reset",
|
|
68
|
-
_textColorClass: "btnReset"
|
|
69
|
-
}), /*#__PURE__*/_jsx(ActionButton, {
|
|
70
|
-
"sentry-label": "ignore devtools query remove action",
|
|
71
|
-
disabled: getQueryStatusLabel(query) === "fetching",
|
|
72
|
-
onClick: () => {
|
|
73
|
-
remove({
|
|
49
|
+
}),
|
|
50
|
+
variant: "invalidate",
|
|
51
|
+
text: "Invalidate"
|
|
52
|
+
}), /*#__PURE__*/_jsx(ActionButton, {
|
|
53
|
+
disabled: queryStatus === "pending",
|
|
54
|
+
onClick: () => reset({
|
|
74
55
|
queryClient,
|
|
75
56
|
query
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
57
|
+
}),
|
|
58
|
+
variant: "reset",
|
|
59
|
+
text: "Reset"
|
|
60
|
+
}), /*#__PURE__*/_jsx(ActionButton, {
|
|
61
|
+
disabled: isFetching,
|
|
62
|
+
onClick: () => {
|
|
63
|
+
remove({
|
|
64
|
+
queryClient,
|
|
65
|
+
query
|
|
66
|
+
});
|
|
67
|
+
setSelectedQuery(undefined);
|
|
68
|
+
},
|
|
69
|
+
variant: "remove",
|
|
70
|
+
text: "Remove"
|
|
71
|
+
})]
|
|
72
|
+
})]
|
|
73
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
74
|
+
style: styles.section,
|
|
75
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
76
|
+
style: styles.sectionLabel,
|
|
77
|
+
children: "Triggers"
|
|
78
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
79
|
+
style: styles.buttonsRow,
|
|
80
|
+
children: [/*#__PURE__*/_jsx(ActionButton, {
|
|
81
|
+
disabled: false,
|
|
82
|
+
onClick: () => triggerLoading({
|
|
87
83
|
query
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
"sentry-label": "ignore devtools query trigger error action",
|
|
95
|
-
disabled: queryStatus === "pending",
|
|
96
|
-
onClick: () => {
|
|
97
|
-
triggerError({
|
|
84
|
+
}),
|
|
85
|
+
variant: "triggerLoading",
|
|
86
|
+
text: query.state.fetchStatus === "fetching" ? "Restore Loading" : "Trigger Loading"
|
|
87
|
+
}), /*#__PURE__*/_jsx(ActionButton, {
|
|
88
|
+
disabled: queryStatus === "pending",
|
|
89
|
+
onClick: () => triggerError({
|
|
98
90
|
query,
|
|
99
91
|
queryClient
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
_textColorClass: "btnTriggerLoadiError"
|
|
92
|
+
}),
|
|
93
|
+
variant: "triggerError",
|
|
94
|
+
text: queryStatus === "error" ? "Restore Error" : "Trigger Error"
|
|
95
|
+
})]
|
|
105
96
|
})]
|
|
106
97
|
})]
|
|
107
98
|
});
|
|
108
99
|
}
|
|
109
100
|
const styles = StyleSheet.create({
|
|
110
101
|
container: {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
padding: 16,
|
|
116
|
-
gap: 12
|
|
102
|
+
gap: 16
|
|
103
|
+
},
|
|
104
|
+
section: {
|
|
105
|
+
gap: 8
|
|
117
106
|
},
|
|
118
|
-
|
|
119
|
-
fontSize:
|
|
120
|
-
fontWeight: "
|
|
121
|
-
color: buoyColors.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
fontFamily: "monospace",
|
|
125
|
-
letterSpacing: 1,
|
|
126
|
-
textTransform: "uppercase"
|
|
107
|
+
sectionLabel: {
|
|
108
|
+
fontSize: 11,
|
|
109
|
+
fontWeight: "600",
|
|
110
|
+
color: buoyColors.textMuted,
|
|
111
|
+
textTransform: "uppercase",
|
|
112
|
+
letterSpacing: 0.5
|
|
127
113
|
},
|
|
128
|
-
|
|
114
|
+
buttonsRow: {
|
|
129
115
|
flexDirection: "row",
|
|
130
116
|
flexWrap: "wrap",
|
|
131
117
|
gap: 8
|
|
@@ -6,14 +6,12 @@ import refetch from "../utils/actions/refetch";
|
|
|
6
6
|
import triggerError from "../utils/actions/triggerError";
|
|
7
7
|
import { getQueryStatusLabel } from "../utils/getQueryStatusLabel";
|
|
8
8
|
/**
|
|
9
|
-
* Derives
|
|
10
|
-
*
|
|
9
|
+
* Derives compact action button configuration for the footer. Returns 3 essential buttons
|
|
10
|
+
* (Refetch, Loading, Error) optimized for small device footprints.
|
|
11
11
|
*
|
|
12
12
|
* @param selectedQuery - The query to derive actions for
|
|
13
13
|
* @param queryClient - The query client for executing actions
|
|
14
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
15
|
*/
|
|
18
16
|
export function useActionButtons(selectedQuery, queryClient, queryVersion) {
|
|
19
17
|
const actionButtons = useMemo(() => {
|
|
@@ -21,24 +19,21 @@ export function useActionButtons(selectedQuery, queryClient, queryVersion) {
|
|
|
21
19
|
const isFetching = getQueryStatusLabel(selectedQuery) === "fetching";
|
|
22
20
|
const buttons = [{
|
|
23
21
|
label: "Refetch",
|
|
24
|
-
|
|
25
|
-
textColorClass: "btnRefetch",
|
|
22
|
+
variant: "refetch",
|
|
26
23
|
disabled: isFetching,
|
|
27
24
|
onPress: () => refetch({
|
|
28
25
|
query: selectedQuery
|
|
29
26
|
})
|
|
30
27
|
}, {
|
|
31
|
-
label: selectedQuery.state.fetchStatus === "fetching" ? "Restore" : "Loading",
|
|
32
|
-
|
|
33
|
-
textColorClass: "btnTriggerLoading",
|
|
28
|
+
label: selectedQuery.state.fetchStatus === "fetching" ? "Restore Loading" : "Trigger Loading",
|
|
29
|
+
variant: "triggerLoading",
|
|
34
30
|
disabled: false,
|
|
35
31
|
onPress: () => triggerLoading({
|
|
36
32
|
query: selectedQuery
|
|
37
33
|
})
|
|
38
34
|
}, {
|
|
39
|
-
label: queryStatus === "error" ? "Restore" : "Error",
|
|
40
|
-
|
|
41
|
-
textColorClass: "btnTriggerLoadiError",
|
|
35
|
+
label: queryStatus === "error" ? "Restore Error" : "Trigger Error",
|
|
36
|
+
variant: "triggerError",
|
|
42
37
|
disabled: queryStatus === "pending",
|
|
43
38
|
onPress: () => triggerError({
|
|
44
39
|
query: selectedQuery,
|
|
@@ -46,9 +41,6 @@ export function useActionButtons(selectedQuery, queryClient, queryVersion) {
|
|
|
46
41
|
})
|
|
47
42
|
}];
|
|
48
43
|
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
44
|
}, [selectedQuery, queryClient, queryVersion]);
|
|
53
45
|
return actionButtons;
|
|
54
46
|
}
|