Skip to content

Commit ea40c75

Browse files
fix: use queryClient wrapper for provider and plugin (#163)
1 parent 6bd2332 commit ea40c75

File tree

6 files changed

+11
-10
lines changed

6 files changed

+11
-10
lines changed

src/vue/__mocks__/useQueryClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { QueryClient } from "react-query/core";
1+
import { QueryClient } from "../queryClient";
22

33
const queryClient = new QueryClient({
44
defaultOptions: {

src/vue/__tests__/useQueryProvider.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { provide, onUnmounted } from "vue-demi";
2-
import { QueryClient } from "react-query/core";
2+
import { QueryClient } from "../queryClient";
33

44
import { useQueryProvider } from "../useQueryProvider";
55
import { VUE_QUERY_CLIENT } from "../utils";
66

7-
jest.mock("react-query/core", () => ({
7+
jest.mock("../queryClient", () => ({
88
QueryClient: jest.fn(),
99
}));
1010

src/vue/__tests__/vueQueryPlugin.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { App, ComponentOptions } from "vue";
22
import { isVue2, isVue3 } from "vue-demi";
3-
import { QueryClient } from "react-query/types/core";
43

4+
import type { QueryClient } from "../queryClient";
55
import { VueQueryPlugin } from "../vueQueryPlugin";
66
import { VUE_QUERY_CLIENT } from "../utils";
77
import { setupDevtools } from "../devtools/devtools";

src/vue/useQueryClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { getCurrentInstance, inject } from "vue-demi";
22

3-
import type { QueryClient } from "react-query/types/core";
3+
import type { QueryClient } from "./queryClient";
44
import { getClientKey } from "./utils";
55

66
export function useQueryClient(id = ""): QueryClient {

src/vue/useQueryProvider.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { provide, onUnmounted } from "vue-demi";
2-
import { QueryClient } from "react-query/core";
32
import type { QueryClientConfig } from "react-query/types/core";
3+
import { QueryClient } from "./queryClient";
44
import { getClientKey } from "./utils";
5+
import { MaybeRefDeep } from "./types";
56

67
export function useQueryProvider(
7-
arg1: QueryClientConfig | QueryClient = {},
8+
arg1: MaybeRefDeep<QueryClientConfig> | QueryClient = {},
89
id = ""
910
): void {
1011
const client = arg1 instanceof QueryClient ? arg1 : new QueryClient(arg1);

src/vue/vueQueryPlugin.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import { isVue2 } from "vue-demi";
2-
import { QueryClient } from "react-query/core";
3-
42
import type { QueryClientConfig } from "react-query/types/core";
53

4+
import { QueryClient } from "./queryClient";
65
import { getClientKey } from "./utils";
76
import { setupDevtools } from "./devtools/devtools";
7+
import { MaybeRefDeep } from "./types";
88

99
export interface AdditionalClient {
1010
queryClient: QueryClient;
1111
queryClientKey: string;
1212
}
1313

1414
interface ConfigOptions {
15-
queryClientConfig?: QueryClientConfig;
15+
queryClientConfig?: MaybeRefDeep<QueryClientConfig>;
1616
queryClientKey?: string;
1717
additionalClients?: AdditionalClient[];
1818
}

0 commit comments

Comments
 (0)