@parca/profile 0.19.67 → 0.19.69

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 (64) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/MatchersInput/SuggestionsList.d.ts.map +1 -1
  3. package/dist/MatchersInput/SuggestionsList.js +2 -13
  4. package/dist/MatchersInput/index.d.ts +1 -1
  5. package/dist/MatchersInput/index.d.ts.map +1 -1
  6. package/dist/MatchersInput/index.js +2 -2
  7. package/dist/ProfileSelector/QueryControls.d.ts +2 -1
  8. package/dist/ProfileSelector/QueryControls.d.ts.map +1 -1
  9. package/dist/ProfileSelector/QueryControls.js +14 -5
  10. package/dist/ProfileSelector/index.d.ts +1 -1
  11. package/dist/ProfileSelector/index.d.ts.map +1 -1
  12. package/dist/ProfileSelector/index.js +23 -18
  13. package/dist/ProfileView/components/ActionButtons/GroupByDropdown.d.ts +2 -0
  14. package/dist/ProfileView/components/ActionButtons/GroupByDropdown.d.ts.map +1 -1
  15. package/dist/ProfileView/components/ActionButtons/GroupByDropdown.js +2 -2
  16. package/dist/ProfileView/components/GroupByLabelsDropdown/index.d.ts +3 -1
  17. package/dist/ProfileView/components/GroupByLabelsDropdown/index.d.ts.map +1 -1
  18. package/dist/ProfileView/components/GroupByLabelsDropdown/index.js +4 -9
  19. package/dist/ProfileView/components/Toolbars/index.d.ts +5 -1
  20. package/dist/ProfileView/components/Toolbars/index.d.ts.map +1 -1
  21. package/dist/ProfileView/components/Toolbars/index.js +2 -2
  22. package/dist/ProfileView/index.d.ts.map +1 -1
  23. package/dist/ProfileView/index.js +5 -1
  24. package/dist/ProfileView/types/visualization.d.ts +1 -0
  25. package/dist/ProfileView/types/visualization.d.ts.map +1 -1
  26. package/dist/ProfileViewWithData.d.ts.map +1 -1
  27. package/dist/ProfileViewWithData.js +3 -1
  28. package/dist/SelectWithRefresh/index.d.ts +10 -0
  29. package/dist/SelectWithRefresh/index.d.ts.map +1 -0
  30. package/dist/SelectWithRefresh/index.js +45 -0
  31. package/dist/SimpleMatchers/Select.d.ts +1 -1
  32. package/dist/SimpleMatchers/Select.d.ts.map +1 -1
  33. package/dist/SimpleMatchers/Select.js +2 -8
  34. package/dist/SimpleMatchers/index.js +1 -1
  35. package/dist/contexts/SimpleMatchersLabelContext.d.ts +2 -2
  36. package/dist/contexts/SimpleMatchersLabelContext.d.ts.map +1 -1
  37. package/dist/contexts/SimpleMatchersLabelContext.js +4 -4
  38. package/dist/index.d.ts +2 -1
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +2 -1
  41. package/dist/styles.css +1 -1
  42. package/dist/useHasProfileData.d.ts.map +1 -1
  43. package/dist/useHasProfileData.js +6 -2
  44. package/dist/useQuery.d.ts +2 -0
  45. package/dist/useQuery.d.ts.map +1 -1
  46. package/dist/useQuery.js +10 -3
  47. package/package.json +4 -4
  48. package/src/MatchersInput/SuggestionsList.tsx +1 -40
  49. package/src/MatchersInput/index.tsx +3 -3
  50. package/src/ProfileSelector/QueryControls.tsx +19 -3
  51. package/src/ProfileSelector/index.tsx +39 -29
  52. package/src/ProfileView/components/ActionButtons/GroupByDropdown.tsx +11 -1
  53. package/src/ProfileView/components/GroupByLabelsDropdown/index.tsx +16 -18
  54. package/src/ProfileView/components/Toolbars/index.tsx +8 -2
  55. package/src/ProfileView/index.tsx +5 -1
  56. package/src/ProfileView/types/visualization.ts +1 -0
  57. package/src/ProfileViewWithData.tsx +3 -0
  58. package/src/SelectWithRefresh/index.tsx +98 -0
  59. package/src/SimpleMatchers/Select.tsx +10 -30
  60. package/src/SimpleMatchers/index.tsx +1 -1
  61. package/src/contexts/SimpleMatchersLabelContext.tsx +6 -6
  62. package/src/index.tsx +9 -1
  63. package/src/useHasProfileData.ts +8 -2
  64. package/src/useQuery.tsx +12 -3
@@ -19,15 +19,25 @@ interface GroupByControlsProps {
19
19
  groupBy: string[];
20
20
  labels: string[];
21
21
  setGroupByLabels: (labels: string[]) => void;
22
+ metadataRefetch?: () => Promise<void>;
23
+ metadataLoading: boolean;
22
24
  }
23
25
 
24
- const GroupByControls: React.FC<GroupByControlsProps> = ({groupBy, labels, setGroupByLabels}) => {
26
+ const GroupByControls: React.FC<GroupByControlsProps> = ({
27
+ groupBy,
28
+ labels,
29
+ setGroupByLabels,
30
+ metadataRefetch,
31
+ metadataLoading,
32
+ }) => {
25
33
  return (
26
34
  <div className="relative flex" id="h-group-by-controls">
27
35
  <GroupByLabelsDropdown
28
36
  labels={labels}
29
37
  groupBy={groupBy}
30
38
  setGroupByLabels={setGroupByLabels}
39
+ metadataRefetch={metadataRefetch}
40
+ metadataLoading={metadataLoading}
31
41
  />
32
42
  </div>
33
43
  );
@@ -11,11 +11,10 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
 
14
- import Select from 'react-select';
15
-
16
14
  import {TEST_IDS, testId} from '@parca/test-utils';
17
15
 
18
16
  import {FIELD_LABELS} from '../../../ProfileFlameGraph/FlameGraphArrow';
17
+ import {SelectWithRefresh} from '../../../SelectWithRefresh';
19
18
 
20
19
  interface LabelOption {
21
20
  label: string;
@@ -26,9 +25,17 @@ interface Props {
26
25
  labels: string[];
27
26
  groupBy: string[];
28
27
  setGroupByLabels: (labels: string[]) => void;
28
+ metadataRefetch?: () => Promise<void>;
29
+ metadataLoading: boolean;
29
30
  }
30
31
 
31
- const GroupByLabelsDropdown = ({labels, groupBy, setGroupByLabels}: Props): JSX.Element => {
32
+ const GroupByLabelsDropdown = ({
33
+ labels,
34
+ groupBy,
35
+ setGroupByLabels,
36
+ metadataRefetch,
37
+ metadataLoading,
38
+ }: Props): JSX.Element => {
32
39
  return (
33
40
  <div className="flex flex-col relative" {...testId(TEST_IDS.GROUP_BY_CONTAINER)}>
34
41
  <div className="flex items-center justify-between">
@@ -37,7 +44,7 @@ const GroupByLabelsDropdown = ({labels, groupBy, setGroupByLabels}: Props): JSX.
37
44
  </label>
38
45
  </div>
39
46
 
40
- <Select<LabelOption, true>
47
+ <SelectWithRefresh<LabelOption, true>
41
48
  isMulti
42
49
  defaultMenuIsOpen={false}
43
50
  defaultValue={undefined}
@@ -45,20 +52,10 @@ const GroupByLabelsDropdown = ({labels, groupBy, setGroupByLabels}: Props): JSX.
45
52
  options={labels.map(label => ({label, value: `${FIELD_LABELS}.${label}`}))}
46
53
  className="parca-select-container text-sm rounded-md bg-white"
47
54
  classNamePrefix="parca-select"
48
- components={{
49
- // eslint-disable-next-line react/prop-types
50
- MenuList: ({children, innerProps}) => (
51
- <div
52
- className="overflow-y-auto"
53
- {...testId(TEST_IDS.GROUP_BY_SELECT_FLYOUT)}
54
- {...innerProps}
55
- // eslint-disable-next-line react/prop-types
56
- style={{...innerProps.style, height: '332px', maxHeight: '332px', fontSize: '14px'}}
57
- >
58
- {children}
59
- </div>
60
- ),
61
- }}
55
+ onRefresh={metadataRefetch}
56
+ refreshTitle="Refresh label names"
57
+ refreshTestId="group-by-refresh-button"
58
+ menuTestId={TEST_IDS.GROUP_BY_SELECT_FLYOUT}
62
59
  value={groupBy
63
60
  .filter(l => l.startsWith(FIELD_LABELS))
64
61
  .map(l => ({value: l, label: l.slice(FIELD_LABELS.length + 1)}))}
@@ -66,6 +63,7 @@ const GroupByLabelsDropdown = ({labels, groupBy, setGroupByLabels}: Props): JSX.
66
63
  setGroupByLabels(newValue.map(option => option.value));
67
64
  }}
68
65
  placeholder="Select labels..."
66
+ isLoading={metadataLoading}
69
67
  styles={{
70
68
  menu: provided => ({
71
69
  ...provided,
@@ -44,7 +44,6 @@ export interface VisualisationToolbarProps {
44
44
  profileType?: ProfileType;
45
45
  total: bigint;
46
46
  filtered: bigint;
47
- groupByLabels: string[];
48
47
  preferencesModal?: boolean;
49
48
  profileViewExternalSubActions?: React.ReactNode;
50
49
  setGroupByLabels: (labels: string[]) => void;
@@ -54,6 +53,11 @@ export interface VisualisationToolbarProps {
54
53
  setAlignFunctionName: (align: string) => void;
55
54
  colorBy: string;
56
55
  setColorBy: (colorBy: string) => void;
56
+ metadata: {
57
+ labels: string[];
58
+ refetch?: () => Promise<void>;
59
+ loading: boolean;
60
+ };
57
61
  }
58
62
 
59
63
  export interface TableToolbarProps {
@@ -130,7 +134,6 @@ const Divider = (): JSX.Element => (
130
134
  export const VisualisationToolbar: FC<VisualisationToolbarProps> = ({
131
135
  groupBy,
132
136
  toggleGroupBy,
133
- groupByLabels,
134
137
  setGroupByLabels,
135
138
  profileType,
136
139
  profileSource,
@@ -147,6 +150,7 @@ export const VisualisationToolbar: FC<VisualisationToolbarProps> = ({
147
150
  setAlignFunctionName,
148
151
  colorBy,
149
152
  setColorBy,
153
+ metadata: {labels: groupByLabels, refetch: metadataRefetch, loading: metadataLoading},
150
154
  }) => {
151
155
  const {dashboardItems} = useDashboard();
152
156
 
@@ -172,6 +176,8 @@ export const VisualisationToolbar: FC<VisualisationToolbarProps> = ({
172
176
  groupBy={groupBy}
173
177
  labels={groupByLabels}
174
178
  setGroupByLabels={setGroupByLabels}
179
+ metadataRefetch={metadataRefetch}
180
+ metadataLoading={metadataLoading}
175
181
  />
176
182
 
177
183
  <InvertCallStack />
@@ -145,7 +145,11 @@ export const ProfileView = ({
145
145
  profileType={profileSource?.ProfileType()}
146
146
  total={total}
147
147
  filtered={filtered}
148
- groupByLabels={flamegraphData.metadataLabels ?? []}
148
+ metadata={{
149
+ labels: flamegraphData.metadataLabels ?? [],
150
+ refetch: flamegraphData.metadataRefetch,
151
+ loading: flamegraphData.metadataLoading,
152
+ }}
149
153
  preferencesModal={preferencesModal}
150
154
  profileViewExternalSubActions={profileViewExternalSubActions}
151
155
  setGroupByLabels={setGroupByLabels}
@@ -24,6 +24,7 @@ export interface FlamegraphData {
24
24
  metadataMappingFiles?: string[];
25
25
  metadataLoading: boolean;
26
26
  metadataLabels?: string[];
27
+ metadataRefetch?: () => Promise<void>;
27
28
  }
28
29
 
29
30
  export interface TopTableData {
@@ -115,10 +115,12 @@ export const ProfileViewWithData = ({
115
115
  isLoading: profileMetadataLoading,
116
116
  response: profileMetadataResponse,
117
117
  error: profileMetadataError,
118
+ refetch: metadataRefetch,
118
119
  } = useQuery(queryClient, profileSource, QueryRequest_ReportType.PROFILE_METADATA, {
119
120
  nodeTrimThreshold,
120
121
  groupBy,
121
122
  protoFilters,
123
+ staleTime: 0,
122
124
  });
123
125
 
124
126
  const {perf} = useParcaContext();
@@ -258,6 +260,7 @@ export const ProfileViewWithData = ({
258
260
  ? profileMetadataResponse?.report?.profileMetadata?.labels
259
261
  : undefined,
260
262
  metadataLoading: profileMetadataLoading,
263
+ metadataRefetch,
261
264
  }}
262
265
  flamechartData={{
263
266
  loading: flamechartLoading && profileMetadataLoading,
@@ -0,0 +1,98 @@
1
+ // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+
14
+ import {useCallback, useState} from 'react';
15
+
16
+ import ReactSelect, {type MenuListProps, type Props as ReactSelectProps} from 'react-select';
17
+
18
+ import {RefreshButton} from '@parca/components';
19
+
20
+ export interface SelectWithRefreshProps<Option, IsMulti extends boolean>
21
+ extends ReactSelectProps<Option, IsMulti> {
22
+ onRefresh?: () => Promise<void>;
23
+ refreshTitle?: string;
24
+ refreshTestId?: string;
25
+ menuTestId?: string;
26
+ }
27
+
28
+ export function SelectWithRefresh<Option, IsMulti extends boolean = false>(
29
+ props: SelectWithRefreshProps<Option, IsMulti>
30
+ ): JSX.Element {
31
+ const {
32
+ onRefresh,
33
+ refreshTitle = 'Refresh label names',
34
+ refreshTestId = 'select-refresh-button',
35
+ menuTestId,
36
+ components,
37
+ ...selectProps
38
+ } = props;
39
+
40
+ const [isRefreshing, setIsRefreshing] = useState(false);
41
+
42
+ const handleRefetch = useCallback(async () => {
43
+ if (onRefresh == null || isRefreshing) return;
44
+
45
+ setIsRefreshing(true);
46
+ try {
47
+ await onRefresh();
48
+ } catch (error) {
49
+ console.error('Error during refresh:', error);
50
+ } finally {
51
+ setIsRefreshing(false);
52
+ }
53
+ }, [onRefresh, isRefreshing]);
54
+
55
+ const MenuListWithRefresh = useCallback(
56
+ ({children, innerProps}: MenuListProps<Option, IsMulti>) => {
57
+ const testIdProps = menuTestId != null ? {'data-testid': menuTestId} : {};
58
+
59
+ return (
60
+ <div className="flex flex-col" style={{maxHeight: '332px'}}>
61
+ <div
62
+ className="overflow-y-auto flex-1"
63
+ {...innerProps}
64
+ {...testIdProps}
65
+ style={{...innerProps?.style, fontSize: '14px'}}
66
+ >
67
+ {children}
68
+ </div>
69
+ {onRefresh != null && (
70
+ <RefreshButton
71
+ onClick={() => void handleRefetch()}
72
+ disabled={isRefreshing}
73
+ title={refreshTitle}
74
+ testId={refreshTestId}
75
+ />
76
+ )}
77
+ </div>
78
+ );
79
+ },
80
+ [onRefresh, isRefreshing, handleRefetch, refreshTitle, refreshTestId, menuTestId]
81
+ );
82
+
83
+ const combinedLoadingState = isRefreshing || (selectProps.isLoading ?? false);
84
+
85
+ return (
86
+ <ReactSelect<Option, IsMulti>
87
+ {...selectProps}
88
+ isLoading={combinedLoadingState}
89
+ components={{
90
+ ...components,
91
+ // eslint-disable-next-line react/display-name
92
+ MenuList: MenuListWithRefresh,
93
+ }}
94
+ />
95
+ );
96
+ }
97
+
98
+ export default SelectWithRefresh;
@@ -17,7 +17,7 @@ import {Icon} from '@iconify/react';
17
17
  import cx from 'classnames';
18
18
  import levenshtein from 'fast-levenshtein';
19
19
 
20
- import {Button, DividerWithLabel, useParcaContext} from '@parca/components';
20
+ import {Button, DividerWithLabel, RefreshButton, useParcaContext} from '@parca/components';
21
21
  import {TEST_IDS, testId} from '@parca/test-utils/dist/test-ids';
22
22
 
23
23
  export interface SelectElement {
@@ -56,7 +56,7 @@ interface CustomSelectProps {
56
56
  searchable?: boolean;
57
57
  onButtonClick?: () => void;
58
58
  editable?: boolean;
59
- refetchValues?: () => void;
59
+ refetchValues?: () => Promise<void>;
60
60
  showLoadingInButton?: boolean;
61
61
  }
62
62
 
@@ -374,34 +374,14 @@ const CustomSelect: React.FC<CustomSelectProps & Record<string, any>> = ({
374
374
  )}
375
375
  </div>
376
376
  {refetchValues !== undefined && loading !== true && (
377
- <div className="sticky bottom-0 w-full flex items-center justify-center px-3 py-2 bg-gray-50 dark:bg-gray-900 border-t border-gray-200 dark:border-gray-700 z-20 mt-auto">
378
- <button
379
- onClick={e => {
380
- e.preventDefault();
381
- e.stopPropagation();
382
- void handleRefetch();
383
- }}
384
- disabled={isRefetching}
385
- className={cx(
386
- 'py-1 px-2 flex items-center gap-1 rounded-full transition-all duration-200 w-auto justify-center',
387
- isRefetching
388
- ? 'cursor-wait opacity-50'
389
- : 'hover:bg-gray-200 dark:hover:bg-gray-700 cursor-pointer'
390
- )}
391
- title="Refresh label values"
392
- type="button"
393
- {...testId(TEST_IDS.LABEL_VALUE_REFRESH_BUTTON)}
394
- >
395
- <Icon
396
- icon="system-uicons:reset"
397
- className={cx(
398
- 'w-3 h-3 text-gray-500 dark:text-gray-400',
399
- isRefetching && 'animate-spin'
400
- )}
401
- />
402
- <span className="text-xs text-gray-500 dark:text-gray-400">Refresh results</span>
403
- </button>
404
- </div>
377
+ <RefreshButton
378
+ onClick={() => void handleRefetch()}
379
+ disabled={isRefetching}
380
+ title="Refresh label values"
381
+ testId={TEST_IDS.LABEL_VALUE_REFRESH_BUTTON}
382
+ sticky={true}
383
+ loading={isRefetching}
384
+ />
405
385
  )}
406
386
  </div>
407
387
  </div>
@@ -485,7 +485,7 @@ const SimpleMatchers = ({
485
485
  onButtonClick={() => handleLabelValueClick(index)}
486
486
  editable={isRowRegex(row)}
487
487
  {...testId(TEST_IDS.LABEL_VALUE_SELECT)}
488
- refetchValues={() => refetchLabelValues(row.labelName)}
488
+ refetchValues={async () => await refetchLabelValues(row.labelName)}
489
489
  showLoadingInButton={true}
490
490
  />
491
491
  <button
@@ -31,8 +31,8 @@ interface LabelContextValue {
31
31
  labelNameOptions: LabelNameSection[];
32
32
  isLoading: boolean;
33
33
  error: Error | null;
34
- refetchLabelValues: (labelName?: string) => void;
35
- refetchLabelNames: () => void;
34
+ refetchLabelValues: (labelName?: string) => Promise<void>;
35
+ refetchLabelNames: () => Promise<void>;
36
36
  }
37
37
 
38
38
  const LabelContext = createContext<LabelContextValue | null>(null);
@@ -141,8 +141,8 @@ export function LabelProvider({
141
141
  }, [profileValues, utilizationValues, labelNameFromMatchers]);
142
142
 
143
143
  const refetchLabelValues = useCallback(
144
- (labelName?: string) => {
145
- void reactQueryClient.refetchQueries({
144
+ async (labelName?: string) => {
145
+ await reactQueryClient.refetchQueries({
146
146
  predicate: query => {
147
147
  const key = query.queryKey;
148
148
  const matchesStructure =
@@ -164,8 +164,8 @@ export function LabelProvider({
164
164
  [reactQueryClient, profileType]
165
165
  );
166
166
 
167
- const refetchLabelNames = useCallback(() => {
168
- refetchLabelNamesQuery();
167
+ const refetchLabelNames = useCallback(async () => {
168
+ await refetchLabelNamesQuery();
169
169
  }, [refetchLabelNamesQuery]);
170
170
 
171
171
  const contextValue = useMemo(
package/src/index.tsx CHANGED
@@ -14,6 +14,7 @@
14
14
  import {useLabelNames} from './MatchersInput';
15
15
  import ProfileExplorer, {getExpressionAsAString} from './ProfileExplorer';
16
16
  import ProfileTypeSelector from './ProfileTypeSelector';
17
+ import SelectWithRefresh from './SelectWithRefresh';
17
18
  import CustomSelect from './SimpleMatchers/Select';
18
19
 
19
20
  export * from './ProfileFlameGraph';
@@ -37,4 +38,11 @@ export const DEFAULT_PROFILE_EXPLORER_PARAM_VALUES = {
37
38
  dashboard_items: 'flamegraph',
38
39
  };
39
40
 
40
- export {ProfileExplorer, ProfileTypeSelector, getExpressionAsAString, CustomSelect, useLabelNames};
41
+ export {
42
+ ProfileExplorer,
43
+ ProfileTypeSelector,
44
+ getExpressionAsAString,
45
+ CustomSelect,
46
+ SelectWithRefresh,
47
+ useLabelNames,
48
+ };
@@ -11,17 +11,23 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
 
14
+ import {useMemo} from 'react';
15
+
14
16
  import {HasProfileDataResponse, QueryServiceClient} from '@parca/client';
17
+ import {useGrpcMetadata} from '@parca/components';
15
18
 
16
19
  import useGrpcQuery from './useGrpcQuery';
17
20
 
18
21
  export const useHasProfileData = (
19
22
  client: QueryServiceClient
20
23
  ): {loading: boolean; data: boolean; error: Error | any} => {
24
+ const metadata = useGrpcMetadata();
25
+ const metadataString = useMemo(() => JSON.stringify(metadata), [metadata]);
26
+
21
27
  const {data, isLoading, error} = useGrpcQuery<HasProfileDataResponse>({
22
- key: ['hasProfileData'],
28
+ key: ['hasProfileData', metadataString],
23
29
  queryFn: async signal => {
24
- const {response} = await client.hasProfileData({}, {abort: signal});
30
+ const {response} = await client.hasProfileData({}, {abort: signal, meta: metadata});
25
31
  return response;
26
32
  },
27
33
  });
package/src/useQuery.tsx CHANGED
@@ -25,6 +25,7 @@ export interface IQueryResult {
25
25
  response: QueryResponse | null;
26
26
  error: RpcError | null;
27
27
  isLoading: boolean;
28
+ refetch?: () => Promise<void>;
28
29
  }
29
30
 
30
31
  interface UseQueryOptions {
@@ -37,6 +38,7 @@ interface UseQueryOptions {
37
38
  invertCallStack?: boolean;
38
39
  sandwichByFunction?: string;
39
40
  protoFilters?: any[]; // Using any[] to match the Filter type from hook
41
+ staleTime?: number;
40
42
  }
41
43
 
42
44
  export const useQuery = (
@@ -52,7 +54,7 @@ export const useQuery = (
52
54
  return JSON.stringify(options?.protoFilters ?? []);
53
55
  }, [options?.protoFilters]);
54
56
 
55
- const {data, isLoading, error} = useGrpcQuery<QueryResponse | undefined>({
57
+ const {data, isLoading, error, refetch} = useGrpcQuery<QueryResponse | undefined>({
56
58
  key: [
57
59
  'query',
58
60
  profileSource.toKey(),
@@ -104,9 +106,16 @@ export const useQuery = (
104
106
  options: {
105
107
  retry: false,
106
108
  enabled: !skip,
107
- staleTime: 1000 * 60 * 5, // 5 minutes
109
+ staleTime: options?.staleTime ?? 1000 * 60 * 5, // 5 minutes
108
110
  },
109
111
  });
110
112
 
111
- return {isLoading, error: error as RpcError | null, response: data ?? null};
113
+ return {
114
+ isLoading,
115
+ error: error as RpcError | null,
116
+ response: data ?? null,
117
+ refetch: async () => {
118
+ await refetch();
119
+ },
120
+ };
112
121
  };