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