@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.
Files changed (59) hide show
  1. package/lib/commonjs/index.js +619 -24
  2. package/lib/commonjs/preset.js +1 -1
  3. package/lib/commonjs/react-query/components/DataEditorMode.js +9 -16
  4. package/lib/commonjs/react-query/components/MutationEditorMode.js +1 -3
  5. package/lib/commonjs/react-query/components/ReactQueryDevToolsModal.js +12 -0
  6. package/lib/commonjs/react-query/components/modals/MutationBrowserModal.js +2 -1
  7. package/lib/commonjs/react-query/components/modals/QueryBrowserModal.js +8 -14
  8. package/lib/commonjs/react-query/components/query-browser/ActionButton.js +40 -69
  9. package/lib/commonjs/react-query/components/query-browser/QueryActions.js +70 -84
  10. package/lib/commonjs/react-query/hooks/useActionButtons.js +7 -15
  11. package/lib/commonjs/react-query/hooks/useAllMutations.js +65 -15
  12. package/lib/commonjs/react-query/hooks/useMutationActionButtons.js +1 -2
  13. package/lib/commonjs/react-query/hooks/useWifiState.js +3 -3
  14. package/lib/commonjs/react-query/index.js +11 -0
  15. package/lib/commonjs/react-query/stores/index.js +48 -0
  16. package/lib/commonjs/react-query/stores/reactQueryEventStore.js +311 -0
  17. package/lib/commonjs/react-query/utils/modalStorageOperations.js +2 -2
  18. package/lib/module/index.js +113 -8
  19. package/lib/module/preset.js +2 -2
  20. package/lib/module/react-query/components/DataEditorMode.js +9 -16
  21. package/lib/module/react-query/components/MutationEditorMode.js +1 -3
  22. package/lib/module/react-query/components/ReactQueryDevToolsModal.js +13 -1
  23. package/lib/module/react-query/components/modals/MutationBrowserModal.js +2 -1
  24. package/lib/module/react-query/components/modals/QueryBrowserModal.js +9 -15
  25. package/lib/module/react-query/components/query-browser/ActionButton.js +40 -70
  26. package/lib/module/react-query/components/query-browser/QueryActions.js +70 -84
  27. package/lib/module/react-query/hooks/useActionButtons.js +7 -15
  28. package/lib/module/react-query/hooks/useAllMutations.js +66 -16
  29. package/lib/module/react-query/hooks/useMutationActionButtons.js +1 -2
  30. package/lib/module/react-query/hooks/useWifiState.js +4 -4
  31. package/lib/module/react-query/index.js +2 -1
  32. package/lib/module/react-query/stores/index.js +3 -0
  33. package/lib/module/react-query/stores/reactQueryEventStore.js +302 -0
  34. package/lib/module/react-query/utils/modalStorageOperations.js +3 -3
  35. package/lib/typescript/index.d.ts +61 -5
  36. package/lib/typescript/index.d.ts.map +1 -1
  37. package/lib/typescript/react-query/components/DataEditorMode.d.ts.map +1 -1
  38. package/lib/typescript/react-query/components/MutationEditorMode.d.ts.map +1 -1
  39. package/lib/typescript/react-query/components/ReactQueryDevToolsModal.d.ts.map +1 -1
  40. package/lib/typescript/react-query/components/modals/MutationBrowserModal.d.ts.map +1 -1
  41. package/lib/typescript/react-query/components/modals/QueryBrowserModal.d.ts.map +1 -1
  42. package/lib/typescript/react-query/components/query-browser/ActionButton.d.ts +4 -42
  43. package/lib/typescript/react-query/components/query-browser/ActionButton.d.ts.map +1 -1
  44. package/lib/typescript/react-query/components/query-browser/QueryActions.d.ts.map +1 -1
  45. package/lib/typescript/react-query/hooks/useActionButtons.d.ts +5 -8
  46. package/lib/typescript/react-query/hooks/useActionButtons.d.ts.map +1 -1
  47. package/lib/typescript/react-query/hooks/useAllMutations.d.ts +2 -2
  48. package/lib/typescript/react-query/hooks/useAllMutations.d.ts.map +1 -1
  49. package/lib/typescript/react-query/hooks/useMutationActionButtons.d.ts +1 -8
  50. package/lib/typescript/react-query/hooks/useMutationActionButtons.d.ts.map +1 -1
  51. package/lib/typescript/react-query/hooks/useWifiState.d.ts +1 -1
  52. package/lib/typescript/react-query/hooks/useWifiState.d.ts.map +1 -1
  53. package/lib/typescript/react-query/index.d.ts +1 -0
  54. package/lib/typescript/react-query/index.d.ts.map +1 -1
  55. package/lib/typescript/react-query/stores/index.d.ts +2 -0
  56. package/lib/typescript/react-query/stores/index.d.ts.map +1 -0
  57. package/lib/typescript/react-query/stores/reactQueryEventStore.d.ts +99 -0
  58. package/lib/typescript/react-query/stores/reactQueryEventStore.d.ts.map +1 -0
  59. package/package.json +17 -3
@@ -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 (0, _sharedUi.safeSetItem)(_sharedUi.devToolsStorageKeys.settings.wifiEnabled(), enabled.toString());
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.actionsGrid,
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
- bgColorClass: action.bgColorClass,
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.actionsGrid,
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
- bgColorClass: action.bgColorClass,
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 matching main dev tools exactly
229
+ // Action footer - compact single row layout
234
230
  actionFooter: {
235
231
  borderTopWidth: 1,
236
232
  borderTopColor: _sharedUi.buoyColors.border,
237
- paddingTop: 4,
233
+ paddingTop: 8,
238
234
  paddingHorizontal: 12,
239
235
  backgroundColor: _sharedUi.buoyColors.base,
240
236
  borderBottomLeftRadius: 14,
241
237
  borderBottomRightRadius: 14
242
238
  },
243
- actionsGrid: {
239
+ actionsRow: {
244
240
  flexDirection: "row",
245
- flexWrap: "wrap",
246
- gap: 6,
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
- bgColorClass: action.bgColorClass,
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
- }, [queryClient]);
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 safeGetItem(_sharedUi.devToolsStorageKeys.reactQuery.ignoredPatterns());
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
- }, [safeGetItem]);
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 safeGetItem(_sharedUi.devToolsStorageKeys.reactQuery.includedPatterns());
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
- }, [safeGetItem]);
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 safeSetItem(_sharedUi.devToolsStorageKeys.reactQuery.ignoredPatterns(), JSON.stringify(patterns));
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, safeSetItem]);
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 safeSetItem(_sharedUi.devToolsStorageKeys.reactQuery.includedPatterns(), JSON.stringify(patterns));
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, safeSetItem]);
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
- // Define the color mappings using Buoy theme colors
10
+ // Clean, minimal color config matching React Query DevTools style
11
11
  const buttonConfigs = {
12
- btnRefetch: {
13
- color: _sharedUi.buoyColors.success,
14
- backgroundColor: _sharedUi.buoyColors.success + "15",
15
- borderColor: _sharedUi.buoyColors.success + "40",
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
- btnInvalidate: {
19
- color: _sharedUi.buoyColors.warning,
20
- backgroundColor: _sharedUi.buoyColors.warning + "15",
21
- borderColor: _sharedUi.buoyColors.warning + "40",
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
- btnReset: {
25
- color: _sharedUi.buoyColors.textSecondary,
26
- backgroundColor: _sharedUi.buoyColors.textSecondary + "26",
27
- borderColor: _sharedUi.buoyColors.textSecondary + "59",
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
- btnRemove: {
31
- color: _sharedUi.buoyColors.error,
32
- backgroundColor: _sharedUi.buoyColors.error + "15",
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
- btnTriggerLoading: {
37
- color: _sharedUi.buoyColors.primary,
38
- backgroundColor: _sharedUi.buoyColors.primary + "15",
39
- borderColor: _sharedUi.buoyColors.primary + "40",
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
- btnTriggerLoadiError: {
43
- color: _sharedUi.buoyColors.textMuted,
44
- backgroundColor: _sharedUi.buoyColors.textMuted + "26",
45
- borderColor: _sharedUi.buoyColors.textMuted + "59",
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
- /** Generic rectangular action button used throughout the query modal footers. */
43
+ /** Clean, minimal action button matching React Query DevTools style. */
50
44
  function ActionButton({
51
45
  onClick,
52
46
  text,
53
- _textColorClass,
54
- bgColorClass,
47
+ variant,
55
48
  disabled
56
49
  }) {
57
- // Get the button configuration
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
- backgroundColor: disabled ? _sharedUi.buoyColors.textMuted + "1A" : config.backgroundColor,
65
- borderColor: disabled ? _sharedUi.buoyColors.textMuted + "33" : config.borderColor,
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.color
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: 6,
92
- // rectangular button shape
82
+ borderRadius: 4,
93
83
  borderWidth: 1,
94
- paddingHorizontal: 12,
95
- paddingVertical: 6,
96
- height: 25,
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: 5,
108
- height: 5,
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: 10,
121
- fontWeight: "600",
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.jsx)(_reactNative.Text, {
35
- style: styles.headerText,
36
- children: "Actions"
37
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
38
- style: styles.buttonsContainer,
39
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionButton.default, {
40
- "sentry-label": "ignore devtools query refetch action",
41
- disabled: (0, _getQueryStatusLabel.getQueryStatusLabel)(query) === "fetching",
42
- onClick: () => {
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
- bgColorClass: "btnRefetch",
48
- text: "Refetch",
49
- _textColorClass: "btnRefetch"
50
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionButton.default, {
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
- bgColorClass: "btnInvalidate",
60
- text: "Invalidate",
61
- _textColorClass: "btnInvalidate"
62
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionButton.default, {
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
- setSelectedQuery(undefined);
83
- },
84
- bgColorClass: "btnRemove",
85
- text: "Remove",
86
- _textColorClass: "btnRemove"
87
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionButton.default, {
88
- "sentry-label": "ignore devtools query trigger loading action",
89
- disabled: false,
90
- onClick: () => {
91
- (0, _triggerLoading.default)({
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
- bgColorClass: "btnTriggerLoading",
96
- text: query.state.fetchStatus === "fetching" ? "Restore Loading" : "Trigger Loading",
97
- _textColorClass: "btnTriggerLoading"
98
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionButton.default, {
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
- bgColorClass: "btnTriggerLoadiError",
108
- text: queryStatus === "error" ? "Restore Error" : "Trigger Error",
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
- backgroundColor: _sharedUi.buoyColors.card,
117
- borderRadius: 12,
118
- borderWidth: 1,
119
- borderColor: _sharedUi.buoyColors.border,
120
- padding: 16,
121
- gap: 12
107
+ gap: 16
108
+ },
109
+ section: {
110
+ gap: 8
122
111
  },
123
- headerText: {
124
- fontSize: 14,
125
- fontWeight: "700",
126
- color: _sharedUi.buoyColors.primary,
127
- marginBottom: 8,
128
- textAlign: "left",
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
- buttonsContainer: {
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 the default action button configuration for an inspected query. Encapsulates business
15
- * rules around when to show refetch, loading, or error simulation actions.
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
- bgColorClass: "btnRefetch",
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
- bgColorClass: "btnTriggerLoading",
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
- bgColorClass: "btnTriggerLoadiError",
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
  }