Skip to content

Commit 019cd62

Browse files
Move QueryKey type
1 parent 795496a commit 019cd62

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

packages/base-data-service/src/BaseDataService.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ import {
2020
InvalidateQueryFilters,
2121
QueryClient,
2222
QueryClientConfig,
23-
QueryKey,
2423
WithRequired,
2524
dehydrate,
2625
} from '@tanstack/query-core';
2726
import deepEqual from 'fast-deep-equal';
2827

28+
// Data service queries use the following format: ['ServiceActionName', ...params]
29+
export type QueryKey = [string, ...Json[]];
30+
2931
export type GranularCacheUpdatedPayload =
3032
| { type: 'added' | 'updated'; state: DehydratedState }
3133
| {

packages/base-data-service/src/hooks.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Json } from '@metamask/utils';
21
import {
32
useQuery as useQueryTanStack,
43
useInfiniteQuery as useInfiniteQueryTanStack,
@@ -11,12 +10,11 @@ import {
1110
UseInfiniteQueryResult,
1211
} from '@tanstack/react-query';
1312

13+
import { QueryKey } from './BaseDataService';
14+
1415
// We provide re-exports of the underlying TanStack Query hooks with narrower types,
1516
// removing `staleTime` and `queryFn` which aren't useful when using data services.
1617

17-
// Data service queries use the following format: ['ServiceActionName', ...params]
18-
export type QueryKey = [string, ...Json[]];
19-
2018
/**
2119
* Consume a query from a data service.
2220
*

packages/base-data-service/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export type {
66
DataServiceEvents,
77
DataServiceCacheUpdatedEvent,
88
DataServiceGranularCacheUpdatedEvent,
9+
QueryKey,
910
} from './BaseDataService';
1011
export { BaseDataService } from './BaseDataService';
1112
export { createUIQueryClient } from './createUIQueryClient';

0 commit comments

Comments
 (0)