@tanstack/solid-query 4.36.1 → 4.39.0
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/package.json +3 -10
- package/build/lib/QueryClientProvider.d.ts.map +0 -1
- package/build/lib/QueryClientProvider.esm.js +0 -74
- package/build/lib/QueryClientProvider.esm.js.map +0 -1
- package/build/lib/QueryClientProvider.js +0 -80
- package/build/lib/QueryClientProvider.js.map +0 -1
- package/build/lib/QueryClientProvider.mjs +0 -74
- package/build/lib/QueryClientProvider.mjs.map +0 -1
- package/build/lib/__tests__/QueryClientProvider.test.d.ts.map +0 -1
- package/build/lib/__tests__/createInfiniteQuery.test.d.ts.map +0 -1
- package/build/lib/__tests__/createMutation.test.d.ts.map +0 -1
- package/build/lib/__tests__/createQueries.test.d.ts.map +0 -1
- package/build/lib/__tests__/createQuery.test.d.ts.map +0 -1
- package/build/lib/__tests__/createQuery.types.test.d.ts.map +0 -1
- package/build/lib/__tests__/suspense.test.d.ts.map +0 -1
- package/build/lib/__tests__/transition.test.d.ts.map +0 -1
- package/build/lib/__tests__/useIsFetching.test.d.ts.map +0 -1
- package/build/lib/__tests__/useIsMutating.test.d.ts.map +0 -1
- package/build/lib/__tests__/utils.d.ts.map +0 -1
- package/build/lib/createBaseQuery.d.ts.map +0 -1
- package/build/lib/createBaseQuery.esm.js +0 -94
- package/build/lib/createBaseQuery.esm.js.map +0 -1
- package/build/lib/createBaseQuery.js +0 -98
- package/build/lib/createBaseQuery.js.map +0 -1
- package/build/lib/createBaseQuery.mjs +0 -94
- package/build/lib/createBaseQuery.mjs.map +0 -1
- package/build/lib/createInfiniteQuery.d.ts.map +0 -1
- package/build/lib/createInfiniteQuery.esm.js +0 -20
- package/build/lib/createInfiniteQuery.esm.js.map +0 -1
- package/build/lib/createInfiniteQuery.js +0 -24
- package/build/lib/createInfiniteQuery.js.map +0 -1
- package/build/lib/createInfiniteQuery.mjs +0 -20
- package/build/lib/createInfiniteQuery.mjs.map +0 -1
- package/build/lib/createMutation.d.ts.map +0 -1
- package/build/lib/createMutation.esm.js +0 -45
- package/build/lib/createMutation.esm.js.map +0 -1
- package/build/lib/createMutation.js +0 -49
- package/build/lib/createMutation.js.map +0 -1
- package/build/lib/createMutation.mjs +0 -45
- package/build/lib/createMutation.mjs.map +0 -1
- package/build/lib/createQueries.d.ts.map +0 -1
- package/build/lib/createQueries.esm.js +0 -52
- package/build/lib/createQueries.esm.js.map +0 -1
- package/build/lib/createQueries.js +0 -56
- package/build/lib/createQueries.js.map +0 -1
- package/build/lib/createQueries.mjs +0 -52
- package/build/lib/createQueries.mjs.map +0 -1
- package/build/lib/createQuery.d.ts.map +0 -1
- package/build/lib/createQuery.esm.js +0 -20
- package/build/lib/createQuery.esm.js.map +0 -1
- package/build/lib/createQuery.js +0 -24
- package/build/lib/createQuery.js.map +0 -1
- package/build/lib/createQuery.mjs +0 -20
- package/build/lib/createQuery.mjs.map +0 -1
- package/build/lib/index.d.ts.map +0 -1
- package/build/lib/index.esm.js +0 -9
- package/build/lib/index.esm.js.map +0 -1
- package/build/lib/index.js +0 -31
- package/build/lib/index.js.map +0 -1
- package/build/lib/index.mjs +0 -9
- package/build/lib/index.mjs.map +0 -1
- package/build/lib/types.d.ts.map +0 -1
- package/build/lib/useIsFetching.d.ts.map +0 -1
- package/build/lib/useIsFetching.esm.js +0 -29
- package/build/lib/useIsFetching.esm.js.map +0 -1
- package/build/lib/useIsFetching.js +0 -33
- package/build/lib/useIsFetching.js.map +0 -1
- package/build/lib/useIsFetching.mjs +0 -29
- package/build/lib/useIsFetching.mjs.map +0 -1
- package/build/lib/useIsMutating.d.ts.map +0 -1
- package/build/lib/useIsMutating.esm.js +0 -22
- package/build/lib/useIsMutating.esm.js.map +0 -1
- package/build/lib/useIsMutating.js +0 -26
- package/build/lib/useIsMutating.js.map +0 -1
- package/build/lib/useIsMutating.mjs +0 -22
- package/build/lib/useIsMutating.mjs.map +0 -1
- package/build/lib/utils.d.ts.map +0 -1
- package/build/lib/utils.esm.js +0 -63
- package/build/lib/utils.esm.js.map +0 -1
- package/build/lib/utils.js +0 -72
- package/build/lib/utils.js.map +0 -1
- package/build/lib/utils.mjs +0 -63
- package/build/lib/utils.mjs.map +0 -1
- package/build/solid/QueryClientProvider.jsx +0 -49
- package/build/solid/__tests__/QueryClientProvider.test.jsx +0 -185
- package/build/solid/__tests__/createInfiniteQuery.test.jsx +0 -1458
- package/build/solid/__tests__/createMutation.test.jsx +0 -857
- package/build/solid/__tests__/createQueries.test.jsx +0 -958
- package/build/solid/__tests__/createQuery.test.jsx +0 -4559
- package/build/solid/__tests__/createQuery.types.test.jsx +0 -124
- package/build/solid/__tests__/suspense.test.jsx +0 -691
- package/build/solid/__tests__/transition.test.jsx +0 -39
- package/build/solid/__tests__/useIsFetching.test.jsx +0 -209
- package/build/solid/__tests__/useIsMutating.test.jsx +0 -216
- package/build/solid/__tests__/utils.jsx +0 -55
- package/build/solid/createBaseQuery.js +0 -81
- package/build/solid/createInfiniteQuery.js +0 -16
- package/build/solid/createMutation.js +0 -40
- package/build/solid/createQueries.js +0 -39
- package/build/solid/createQuery.js +0 -16
- package/build/solid/index.js +0 -12
- package/build/solid/types.js +0 -2
- package/build/solid/useIsFetching.js +0 -23
- package/build/solid/useIsMutating.js +0 -16
- package/build/solid/utils.js +0 -45
- package/build/umd/index.development.js +0 -3678
- package/build/umd/index.development.js.map +0 -1
- package/build/umd/index.production.js +0 -2
- package/build/umd/index.production.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/solid-query",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.39.0",
|
|
4
4
|
"description": "Primitives for managing, caching and syncing asynchronous and remote data in Solid",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,18 +40,11 @@
|
|
|
40
40
|
"solid-jest": "^0.2.0"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@tanstack/query-core": "4.
|
|
43
|
+
"@tanstack/query-core": "4.39.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"solid-js": "^1.5.7"
|
|
47
47
|
},
|
|
48
48
|
"peerDependenciesMeta": {},
|
|
49
|
-
"scripts": {
|
|
50
|
-
"clean": "rimraf ./build",
|
|
51
|
-
"test:eslint": "eslint --ext .ts,.tsx ./src",
|
|
52
|
-
"test:types": "tsc",
|
|
53
|
-
"test:lib": "jest --config ./jest.config.ts",
|
|
54
|
-
"test:lib:dev": "pnpm run test:lib --watch",
|
|
55
|
-
"build:types": "tsc --build"
|
|
56
|
-
}
|
|
49
|
+
"scripts": {}
|
|
57
50
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QueryClientProvider.d.ts","sourceRoot":"","sources":["../../src/QueryClientProvider.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,uBAAuB,CAAC,EAAE,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAAA;KAC3D;CACF;AAED,eAAO,MAAM,cAAc,kCAAoD,CAAA;AA4B/E,eAAO,MAAM,cAAc,iBAAiB,cAAc,gBAUzD,CAAA;AAED,aAAK,4BAA4B,GAAG;IAClC,MAAM,EAAE,WAAW,CAAA;IACnB,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CACvB,CAAA;AACD,aAAK,mCAAmC,GAAG,cAAc,GAAG;IAC1D,cAAc,CAAC,EAAE,KAAK,CAAA;CACvB,GAAG,4BAA4B,CAAA;AAChC,aAAK,0CAA0C,GAAG;IAChD,OAAO,CAAC,EAAE,KAAK,CAAA;IACf,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,GAAG,4BAA4B,CAAA;AAEhC,oBAAY,wBAAwB,GAChC,mCAAmC,GACnC,0CAA0C,CAAA;AAE9C,eAAO,MAAM,mBAAmB,UACvB,wBAAwB,KAC9B,WAkCF,CAAA"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext, mergeProps, onMount, onCleanup, createComponent } from 'solid-js';
|
|
2
|
-
|
|
3
|
-
const defaultContext = createContext(undefined);
|
|
4
|
-
const QueryClientSharingContext = createContext(false); // If we are given a context, we will use it.
|
|
5
|
-
// Otherwise, if contextSharing is on, we share the first and at least one
|
|
6
|
-
// instance of the context across the window
|
|
7
|
-
// to ensure that if Solid Query is used across
|
|
8
|
-
// different bundles or microfrontends they will
|
|
9
|
-
// all use the same **instance** of context, regardless
|
|
10
|
-
// of module scoping.
|
|
11
|
-
|
|
12
|
-
function getQueryClientContext(context, contextSharing) {
|
|
13
|
-
if (context) {
|
|
14
|
-
return context;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (contextSharing && typeof window !== 'undefined') {
|
|
18
|
-
if (!window.SolidQueryClientContext) {
|
|
19
|
-
window.SolidQueryClientContext = defaultContext;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return window.SolidQueryClientContext;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return defaultContext;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const useQueryClient = ({
|
|
29
|
-
context
|
|
30
|
-
} = {}) => {
|
|
31
|
-
const queryClient = useContext(getQueryClientContext(context, useContext(QueryClientSharingContext)));
|
|
32
|
-
|
|
33
|
-
if (!queryClient) {
|
|
34
|
-
throw new Error('No QueryClient set, use QueryClientProvider to set one');
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return queryClient;
|
|
38
|
-
};
|
|
39
|
-
const QueryClientProvider = props => {
|
|
40
|
-
const mergedProps = mergeProps({
|
|
41
|
-
contextSharing: false
|
|
42
|
-
}, props);
|
|
43
|
-
onMount(() => {
|
|
44
|
-
mergedProps.client.mount();
|
|
45
|
-
|
|
46
|
-
if (process.env.NODE_ENV !== 'production' && mergedProps.contextSharing) {
|
|
47
|
-
mergedProps.client.getLogger().error("The contextSharing option has been deprecated and will be removed in the next major version");
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
onCleanup(() => mergedProps.client.unmount());
|
|
51
|
-
const QueryClientContext = getQueryClientContext(mergedProps.context, mergedProps.contextSharing);
|
|
52
|
-
return createComponent(QueryClientSharingContext.Provider, {
|
|
53
|
-
get value() {
|
|
54
|
-
return !mergedProps.context && mergedProps.contextSharing;
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
get children() {
|
|
58
|
-
return createComponent(QueryClientContext.Provider, {
|
|
59
|
-
get value() {
|
|
60
|
-
return mergedProps.client;
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
get children() {
|
|
64
|
-
return mergedProps.children;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export { QueryClientProvider, defaultContext, useQueryClient };
|
|
74
|
-
//# sourceMappingURL=QueryClientProvider.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QueryClientProvider.esm.js","sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["import {\n createContext,\n mergeProps,\n onCleanup,\n onMount,\n useContext,\n} from 'solid-js'\nimport type { QueryClient } from '@tanstack/query-core'\nimport type { Context, JSX } from 'solid-js'\nimport type { ContextOptions } from './types'\n\ndeclare global {\n interface Window {\n SolidQueryClientContext?: Context<QueryClient | undefined>\n }\n}\n\nexport const defaultContext = createContext<QueryClient | undefined>(undefined)\nconst QueryClientSharingContext = createContext<boolean>(false)\n\n// If we are given a context, we will use it.\n// Otherwise, if contextSharing is on, we share the first and at least one\n// instance of the context across the window\n// to ensure that if Solid Query is used across\n// different bundles or microfrontends they will\n// all use the same **instance** of context, regardless\n// of module scoping.\nfunction getQueryClientContext(\n context: Context<QueryClient | undefined> | undefined,\n contextSharing: boolean,\n) {\n if (context) {\n return context\n }\n if (contextSharing && typeof window !== 'undefined') {\n if (!window.SolidQueryClientContext) {\n window.SolidQueryClientContext = defaultContext\n }\n\n return window.SolidQueryClientContext\n }\n\n return defaultContext\n}\n\nexport const useQueryClient = ({ context }: ContextOptions = {}) => {\n const queryClient = useContext(\n getQueryClientContext(context, useContext(QueryClientSharingContext)),\n )\n\n if (!queryClient) {\n throw new Error('No QueryClient set, use QueryClientProvider to set one')\n }\n\n return queryClient\n}\n\ntype QueryClientProviderPropsBase = {\n client: QueryClient\n children?: JSX.Element\n}\ntype QueryClientProviderPropsWithContext = ContextOptions & {\n contextSharing?: never\n} & QueryClientProviderPropsBase\ntype QueryClientProviderPropsWithContextSharing = {\n context?: never\n contextSharing?: boolean\n} & QueryClientProviderPropsBase\n\nexport type QueryClientProviderProps =\n | QueryClientProviderPropsWithContext\n | QueryClientProviderPropsWithContextSharing\n\nexport const QueryClientProvider = (\n props: QueryClientProviderProps,\n): JSX.Element => {\n const mergedProps = mergeProps(\n {\n contextSharing: false,\n },\n props,\n )\n onMount(() => {\n mergedProps.client.mount()\n\n if (process.env.NODE_ENV !== 'production' && mergedProps.contextSharing) {\n mergedProps.client\n .getLogger()\n .error(\n `The contextSharing option has been deprecated and will be removed in the next major version`,\n )\n }\n })\n onCleanup(() => mergedProps.client.unmount())\n\n const QueryClientContext = getQueryClientContext(\n mergedProps.context,\n mergedProps.contextSharing,\n )\n\n return (\n <QueryClientSharingContext.Provider\n value={!mergedProps.context && mergedProps.contextSharing}\n >\n <QueryClientContext.Provider value={mergedProps.client}>\n {mergedProps.children}\n </QueryClientContext.Provider>\n </QueryClientSharingContext.Provider>\n )\n}\n"],"names":["defaultContext","createContext","undefined","QueryClientSharingContext","getQueryClientContext","context","contextSharing","window","SolidQueryClientContext","useQueryClient","queryClient","useContext","Error","QueryClientProvider","props","mergedProps","mergeProps","onMount","client","mount","process","env","NODE_ENV","getLogger","error","onCleanup","unmount","QueryClientContext","_$createComponent","children"],"mappings":";;MAiBaA,cAAc,GAAGC,aAAa,CAA0BC,SAA1B,EAApC;AACP,MAAMC,yBAAyB,GAAGF,aAAa,CAAU,KAAV,CAA/C;AAGA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASG,qBAAT,CACEC,OADF,EAEEC,cAFF,EAGE;AACA,EAAA,IAAID,OAAJ,EAAa;AACX,IAAA,OAAOA,OAAP,CAAA;AACD,GAAA;;AACD,EAAA,IAAIC,cAAc,IAAI,OAAOC,MAAP,KAAkB,WAAxC,EAAqD;AACnD,IAAA,IAAI,CAACA,MAAM,CAACC,uBAAZ,EAAqC;MACnCD,MAAM,CAACC,uBAAP,GAAiCR,cAAjC,CAAA;AACD,KAAA;;IAED,OAAOO,MAAM,CAACC,uBAAd,CAAA;AACD,GAAA;;AAED,EAAA,OAAOR,cAAP,CAAA;AACD,CAAA;;AAEM,MAAMS,cAAc,GAAG,CAAC;AAAEJ,EAAAA,OAAAA;AAAF,CAAA,GAA8B,EAA/B,KAAsC;AAClE,EAAA,MAAMK,WAAW,GAAGC,UAAU,CAC5BP,qBAAqB,CAACC,OAAD,EAAUM,UAAU,CAACR,yBAAD,CAApB,CADO,CAA9B,CAAA;;EAIA,IAAI,CAACO,WAAL,EAAkB;AAChB,IAAA,MAAM,IAAIE,KAAJ,CAAU,wDAAV,CAAN,CAAA;AACD,GAAA;;AAED,EAAA,OAAOF,WAAP,CAAA;AACD,EAVM;AA4BMG,MAAAA,mBAAmB,GAC9BC,KADiC,IAEjB;EAChB,MAAMC,WAAW,GAAGC,UAAU,CAC5B;AACEV,IAAAA,cAAc,EAAE,KAAA;GAFU,EAI5BQ,KAJ4B,CAA9B,CAAA;AAMAG,EAAAA,OAAO,CAAC,MAAM;IACZF,WAAW,CAACG,MAAZ,CAAmBC,KAAnB,EAAA,CAAA;;IAEA,IAAIC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAAzB,IAAyCP,WAAW,CAACT,cAAzD,EAAyE;AACvES,MAAAA,WAAW,CAACG,MAAZ,CACGK,SADH,GAEGC,KAFH,CAAA,6FAAA,CAAA,CAAA;AAKD,KAAA;AACF,GAVM,CAAP,CAAA;EAWAC,SAAS,CAAC,MAAMV,WAAW,CAACG,MAAZ,CAAmBQ,OAAnB,EAAP,CAAT,CAAA;EAEA,MAAMC,kBAAkB,GAAGvB,qBAAqB,CAC9CW,WAAW,CAACV,OADkC,EAE9CU,WAAW,CAACT,cAFkC,CAAhD,CAAA;EAKA,OACGsB,eAAA,CAAA,yBADH,CAC6B,QAD7B,EAAA;AAAA,IAAA,IAEI,KAFJ,GAAA;AAAA,MAAA,OAEW,CAACb,WAAW,CAACV,OAAb,IAAwBU,WAAW,CAACT,cAF/C,CAAA;AAAA,KAAA;;AAAA,IAAA,IAAA,QAAA,GAAA;MAAA,OAIKsB,eAAA,CAAA,kBAJL,CAIwB,QAJxB,EAAA;AAAA,QAAA,IAIiC,KAJjC,GAAA;UAAA,OAIwCb,WAAW,CAACG,MAJpD,CAAA;AAAA,SAAA;;AAAA,QAAA,IAAA,QAAA,GAAA;UAAA,OAKOH,WAAW,CAACc,QALnB,CAAA;AAAA,SAAA;;AAAA,OAAA,CAAA,CAAA;AAAA,KAAA;;AAAA,GAAA,CAAA,CAAA;AASD;;;;"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var solidJs = require('solid-js');
|
|
6
|
-
|
|
7
|
-
const defaultContext = solidJs.createContext(undefined);
|
|
8
|
-
const QueryClientSharingContext = solidJs.createContext(false); // If we are given a context, we will use it.
|
|
9
|
-
// Otherwise, if contextSharing is on, we share the first and at least one
|
|
10
|
-
// instance of the context across the window
|
|
11
|
-
// to ensure that if Solid Query is used across
|
|
12
|
-
// different bundles or microfrontends they will
|
|
13
|
-
// all use the same **instance** of context, regardless
|
|
14
|
-
// of module scoping.
|
|
15
|
-
|
|
16
|
-
function getQueryClientContext(context, contextSharing) {
|
|
17
|
-
if (context) {
|
|
18
|
-
return context;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (contextSharing && typeof window !== 'undefined') {
|
|
22
|
-
if (!window.SolidQueryClientContext) {
|
|
23
|
-
window.SolidQueryClientContext = defaultContext;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return window.SolidQueryClientContext;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return defaultContext;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const useQueryClient = ({
|
|
33
|
-
context
|
|
34
|
-
} = {}) => {
|
|
35
|
-
const queryClient = solidJs.useContext(getQueryClientContext(context, solidJs.useContext(QueryClientSharingContext)));
|
|
36
|
-
|
|
37
|
-
if (!queryClient) {
|
|
38
|
-
throw new Error('No QueryClient set, use QueryClientProvider to set one');
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return queryClient;
|
|
42
|
-
};
|
|
43
|
-
const QueryClientProvider = props => {
|
|
44
|
-
const mergedProps = solidJs.mergeProps({
|
|
45
|
-
contextSharing: false
|
|
46
|
-
}, props);
|
|
47
|
-
solidJs.onMount(() => {
|
|
48
|
-
mergedProps.client.mount();
|
|
49
|
-
|
|
50
|
-
if (process.env.NODE_ENV !== 'production' && mergedProps.contextSharing) {
|
|
51
|
-
mergedProps.client.getLogger().error("The contextSharing option has been deprecated and will be removed in the next major version");
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
solidJs.onCleanup(() => mergedProps.client.unmount());
|
|
55
|
-
const QueryClientContext = getQueryClientContext(mergedProps.context, mergedProps.contextSharing);
|
|
56
|
-
return solidJs.createComponent(QueryClientSharingContext.Provider, {
|
|
57
|
-
get value() {
|
|
58
|
-
return !mergedProps.context && mergedProps.contextSharing;
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
get children() {
|
|
62
|
-
return solidJs.createComponent(QueryClientContext.Provider, {
|
|
63
|
-
get value() {
|
|
64
|
-
return mergedProps.client;
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
get children() {
|
|
68
|
-
return mergedProps.children;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
exports.QueryClientProvider = QueryClientProvider;
|
|
78
|
-
exports.defaultContext = defaultContext;
|
|
79
|
-
exports.useQueryClient = useQueryClient;
|
|
80
|
-
//# sourceMappingURL=QueryClientProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QueryClientProvider.js","sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["import {\n createContext,\n mergeProps,\n onCleanup,\n onMount,\n useContext,\n} from 'solid-js'\nimport type { QueryClient } from '@tanstack/query-core'\nimport type { Context, JSX } from 'solid-js'\nimport type { ContextOptions } from './types'\n\ndeclare global {\n interface Window {\n SolidQueryClientContext?: Context<QueryClient | undefined>\n }\n}\n\nexport const defaultContext = createContext<QueryClient | undefined>(undefined)\nconst QueryClientSharingContext = createContext<boolean>(false)\n\n// If we are given a context, we will use it.\n// Otherwise, if contextSharing is on, we share the first and at least one\n// instance of the context across the window\n// to ensure that if Solid Query is used across\n// different bundles or microfrontends they will\n// all use the same **instance** of context, regardless\n// of module scoping.\nfunction getQueryClientContext(\n context: Context<QueryClient | undefined> | undefined,\n contextSharing: boolean,\n) {\n if (context) {\n return context\n }\n if (contextSharing && typeof window !== 'undefined') {\n if (!window.SolidQueryClientContext) {\n window.SolidQueryClientContext = defaultContext\n }\n\n return window.SolidQueryClientContext\n }\n\n return defaultContext\n}\n\nexport const useQueryClient = ({ context }: ContextOptions = {}) => {\n const queryClient = useContext(\n getQueryClientContext(context, useContext(QueryClientSharingContext)),\n )\n\n if (!queryClient) {\n throw new Error('No QueryClient set, use QueryClientProvider to set one')\n }\n\n return queryClient\n}\n\ntype QueryClientProviderPropsBase = {\n client: QueryClient\n children?: JSX.Element\n}\ntype QueryClientProviderPropsWithContext = ContextOptions & {\n contextSharing?: never\n} & QueryClientProviderPropsBase\ntype QueryClientProviderPropsWithContextSharing = {\n context?: never\n contextSharing?: boolean\n} & QueryClientProviderPropsBase\n\nexport type QueryClientProviderProps =\n | QueryClientProviderPropsWithContext\n | QueryClientProviderPropsWithContextSharing\n\nexport const QueryClientProvider = (\n props: QueryClientProviderProps,\n): JSX.Element => {\n const mergedProps = mergeProps(\n {\n contextSharing: false,\n },\n props,\n )\n onMount(() => {\n mergedProps.client.mount()\n\n if (process.env.NODE_ENV !== 'production' && mergedProps.contextSharing) {\n mergedProps.client\n .getLogger()\n .error(\n `The contextSharing option has been deprecated and will be removed in the next major version`,\n )\n }\n })\n onCleanup(() => mergedProps.client.unmount())\n\n const QueryClientContext = getQueryClientContext(\n mergedProps.context,\n mergedProps.contextSharing,\n )\n\n return (\n <QueryClientSharingContext.Provider\n value={!mergedProps.context && mergedProps.contextSharing}\n >\n <QueryClientContext.Provider value={mergedProps.client}>\n {mergedProps.children}\n </QueryClientContext.Provider>\n </QueryClientSharingContext.Provider>\n )\n}\n"],"names":["defaultContext","createContext","undefined","QueryClientSharingContext","getQueryClientContext","context","contextSharing","window","SolidQueryClientContext","useQueryClient","queryClient","useContext","Error","QueryClientProvider","props","mergedProps","mergeProps","onMount","client","mount","process","env","NODE_ENV","getLogger","error","onCleanup","unmount","QueryClientContext","_$createComponent","children"],"mappings":";;;;;;MAiBaA,cAAc,GAAGC,qBAAa,CAA0BC,SAA1B,EAApC;AACP,MAAMC,yBAAyB,GAAGF,qBAAa,CAAU,KAAV,CAA/C;AAGA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASG,qBAAT,CACEC,OADF,EAEEC,cAFF,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;EAEA,MAAMC,kBAAkB,GAAGvB,qBAAqB,CAC9CW,WAAW,CAACV,OADkC,EAE9CU,WAAW,CAACT,cAFkC,CAAhD,CAAA;EAKA,OACGsB,uBAAA,CAAA,yBADH,CAC6B,QAD7B,EAAA;AAAA,IAAA,IAEI,KAFJ,GAAA;AAAA,MAAA,OAEW,CAACb,WAAW,CAACV,OAAb,IAAwBU,WAAW,CAACT,cAF/C,CAAA;AAAA,KAAA;;AAAA,IAAA,IAAA,QAAA,GAAA;MAAA,OAIKsB,uBAAA,CAAA,kBAJL,CAIwB,QAJxB,EAAA;AAAA,QAAA,IAIiC,KAJjC,GAAA;UAAA,OAIwCb,WAAW,CAACG,MAJpD,CAAA;AAAA,SAAA;;AAAA,QAAA,IAAA,QAAA,GAAA;UAAA,OAKOH,WAAW,CAACc,QALnB,CAAA;AAAA,SAAA;;AAAA,OAAA,CAAA,CAAA;AAAA,KAAA;;AAAA,GAAA,CAAA,CAAA;AASD;;;;;;"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext, mergeProps, onMount, onCleanup, createComponent } from 'solid-js';
|
|
2
|
-
|
|
3
|
-
const defaultContext = createContext(undefined);
|
|
4
|
-
const QueryClientSharingContext = createContext(false); // If we are given a context, we will use it.
|
|
5
|
-
// Otherwise, if contextSharing is on, we share the first and at least one
|
|
6
|
-
// instance of the context across the window
|
|
7
|
-
// to ensure that if Solid Query is used across
|
|
8
|
-
// different bundles or microfrontends they will
|
|
9
|
-
// all use the same **instance** of context, regardless
|
|
10
|
-
// of module scoping.
|
|
11
|
-
|
|
12
|
-
function getQueryClientContext(context, contextSharing) {
|
|
13
|
-
if (context) {
|
|
14
|
-
return context;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (contextSharing && typeof window !== 'undefined') {
|
|
18
|
-
if (!window.SolidQueryClientContext) {
|
|
19
|
-
window.SolidQueryClientContext = defaultContext;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return window.SolidQueryClientContext;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return defaultContext;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const useQueryClient = ({
|
|
29
|
-
context
|
|
30
|
-
} = {}) => {
|
|
31
|
-
const queryClient = useContext(getQueryClientContext(context, useContext(QueryClientSharingContext)));
|
|
32
|
-
|
|
33
|
-
if (!queryClient) {
|
|
34
|
-
throw new Error('No QueryClient set, use QueryClientProvider to set one');
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return queryClient;
|
|
38
|
-
};
|
|
39
|
-
const QueryClientProvider = props => {
|
|
40
|
-
const mergedProps = mergeProps({
|
|
41
|
-
contextSharing: false
|
|
42
|
-
}, props);
|
|
43
|
-
onMount(() => {
|
|
44
|
-
mergedProps.client.mount();
|
|
45
|
-
|
|
46
|
-
if (process.env.NODE_ENV !== 'production' && mergedProps.contextSharing) {
|
|
47
|
-
mergedProps.client.getLogger().error("The contextSharing option has been deprecated and will be removed in the next major version");
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
onCleanup(() => mergedProps.client.unmount());
|
|
51
|
-
const QueryClientContext = getQueryClientContext(mergedProps.context, mergedProps.contextSharing);
|
|
52
|
-
return createComponent(QueryClientSharingContext.Provider, {
|
|
53
|
-
get value() {
|
|
54
|
-
return !mergedProps.context && mergedProps.contextSharing;
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
get children() {
|
|
58
|
-
return createComponent(QueryClientContext.Provider, {
|
|
59
|
-
get value() {
|
|
60
|
-
return mergedProps.client;
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
get children() {
|
|
64
|
-
return mergedProps.children;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export { QueryClientProvider, defaultContext, useQueryClient };
|
|
74
|
-
//# sourceMappingURL=QueryClientProvider.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QueryClientProvider.mjs","sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["import {\n createContext,\n mergeProps,\n onCleanup,\n onMount,\n useContext,\n} from 'solid-js'\nimport type { QueryClient } from '@tanstack/query-core'\nimport type { Context, JSX } from 'solid-js'\nimport type { ContextOptions } from './types'\n\ndeclare global {\n interface Window {\n SolidQueryClientContext?: Context<QueryClient | undefined>\n }\n}\n\nexport const defaultContext = createContext<QueryClient | undefined>(undefined)\nconst QueryClientSharingContext = createContext<boolean>(false)\n\n// If we are given a context, we will use it.\n// Otherwise, if contextSharing is on, we share the first and at least one\n// instance of the context across the window\n// to ensure that if Solid Query is used across\n// different bundles or microfrontends they will\n// all use the same **instance** of context, regardless\n// of module scoping.\nfunction getQueryClientContext(\n context: Context<QueryClient | undefined> | undefined,\n contextSharing: boolean,\n) {\n if (context) {\n return context\n }\n if (contextSharing && typeof window !== 'undefined') {\n if (!window.SolidQueryClientContext) {\n window.SolidQueryClientContext = defaultContext\n }\n\n return window.SolidQueryClientContext\n }\n\n return defaultContext\n}\n\nexport const useQueryClient = ({ context }: ContextOptions = {}) => {\n const queryClient = useContext(\n getQueryClientContext(context, useContext(QueryClientSharingContext)),\n )\n\n if (!queryClient) {\n throw new Error('No QueryClient set, use QueryClientProvider to set one')\n }\n\n return queryClient\n}\n\ntype QueryClientProviderPropsBase = {\n client: QueryClient\n children?: JSX.Element\n}\ntype QueryClientProviderPropsWithContext = ContextOptions & {\n contextSharing?: never\n} & QueryClientProviderPropsBase\ntype QueryClientProviderPropsWithContextSharing = {\n context?: never\n contextSharing?: boolean\n} & QueryClientProviderPropsBase\n\nexport type QueryClientProviderProps =\n | QueryClientProviderPropsWithContext\n | QueryClientProviderPropsWithContextSharing\n\nexport const QueryClientProvider = (\n props: QueryClientProviderProps,\n): JSX.Element => {\n const mergedProps = mergeProps(\n {\n contextSharing: false,\n },\n props,\n )\n onMount(() => {\n mergedProps.client.mount()\n\n if (process.env.NODE_ENV !== 'production' && mergedProps.contextSharing) {\n mergedProps.client\n .getLogger()\n .error(\n `The contextSharing option has been deprecated and will be removed in the next major version`,\n )\n }\n })\n onCleanup(() => mergedProps.client.unmount())\n\n const QueryClientContext = getQueryClientContext(\n mergedProps.context,\n mergedProps.contextSharing,\n )\n\n return (\n <QueryClientSharingContext.Provider\n value={!mergedProps.context && mergedProps.contextSharing}\n >\n <QueryClientContext.Provider value={mergedProps.client}>\n {mergedProps.children}\n </QueryClientContext.Provider>\n </QueryClientSharingContext.Provider>\n )\n}\n"],"names":["defaultContext","createContext","undefined","QueryClientSharingContext","getQueryClientContext","context","contextSharing","window","SolidQueryClientContext","useQueryClient","queryClient","useContext","Error","QueryClientProvider","props","mergedProps","mergeProps","onMount","client","mount","process","env","NODE_ENV","getLogger","error","onCleanup","unmount","QueryClientContext","_$createComponent","children"],"mappings":";;MAiBaA,cAAc,GAAGC,aAAa,CAA0BC,SAA1B,EAApC;AACP,MAAMC,yBAAyB,GAAGF,aAAa,CAAU,KAAV,CAA/C;AAGA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASG,qBAAT,CACEC,OADF,EAEEC,cAFF,EAGE;AACA,EAAA,IAAID,OAAJ,EAAa;AACX,IAAA,OAAOA,OAAP,CAAA;AACD,GAAA;;AACD,EAAA,IAAIC,cAAc,IAAI,OAAOC,MAAP,KAAkB,WAAxC,EAAqD;AACnD,IAAA,IAAI,CAACA,MAAM,CAACC,uBAAZ,EAAqC;MACnCD,MAAM,CAACC,uBAAP,GAAiCR,cAAjC,CAAA;AACD,KAAA;;IAED,OAAOO,MAAM,CAACC,uBAAd,CAAA;AACD,GAAA;;AAED,EAAA,OAAOR,cAAP,CAAA;AACD,CAAA;;AAEM,MAAMS,cAAc,GAAG,CAAC;AAAEJ,EAAAA,OAAAA;AAAF,CAAA,GAA8B,EAA/B,KAAsC;AAClE,EAAA,MAAMK,WAAW,GAAGC,UAAU,CAC5BP,qBAAqB,CAACC,OAAD,E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B,CAAA;AAAA,SAAA;;AAAA,OAAA,CAAA,CAAA;AAAA,KAAA;;AAAA,GAAA,CAAA,CAAA;AASD;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QueryClientProvider.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/QueryClientProvider.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createInfiniteQuery.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/createInfiniteQuery.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createMutation.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/createMutation.test.tsx"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createQueries.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/createQueries.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createQuery.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/createQuery.test.tsx"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createQuery.types.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/createQuery.types.test.tsx"],"names":[],"mappings":"AAEA,oBAAY,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,SAAS,CAC/D,CAAC,OACI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,GACtB,IAAI,GACJ,KAAK,CAAA;AAET,oBAAY,MAAM,CAAC,CAAC,SAAS,IAAI,IAAI,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"suspense.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/suspense.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transition.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/transition.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useIsFetching.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/useIsFetching.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useIsMutating.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/useIsMutating.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/__tests__/utils.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAElD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAG3C,wBAAgB,QAAQ,IAAI,MAAM,KAAK,CAAC,MAAM,CAAC,CAG9C;AAED,eAAO,MAAM,KAAK,UACT;IACL,QAAQ,EAAE,MAAM,CAAA;CACjB,GAAG,WAAW,mCAehB,CAAA;AAED,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,WAAW,CAGzE;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,uBAAuB,iDAEjE;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,iCAEjD;AAED,eAAO,MAAM,UAAU;;;;CAItB,CAAA;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIpD;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,IAAI,EAAE,EAAE,CAAC,EAAE,MAAM,kBAIxD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,CAExC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,IAAI,CAExE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createBaseQuery.d.ts","sourceRoot":"","sources":["../../src/createBaseQuery.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AACzE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAGrD,wBAAgB,eAAe,CAC7B,YAAY,EACZ,MAAM,EACN,KAAK,EACL,UAAU,EACV,SAAS,SAAS,QAAQ,EAE1B,OAAO,EAAE,sBAAsB,CAC7B,YAAY,EACZ,MAAM,EACN,KAAK,EACL,UAAU,EACV,SAAS,CACV,EACD,QAAQ,EAAE,OAAO,aAAa,GAC7B,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,CAoGpC"}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { createResource, batch, onCleanup, onMount, createComputed, on } from 'solid-js';
|
|
2
|
-
import { createStore, unwrap } from 'solid-js/store';
|
|
3
|
-
import { useQueryClient } from './QueryClientProvider.esm.js';
|
|
4
|
-
import { shouldThrowError } from './utils.esm.js';
|
|
5
|
-
|
|
6
|
-
// Base Query Function that is used to create the query.
|
|
7
|
-
function createBaseQuery(options, Observer) {
|
|
8
|
-
const queryClient = useQueryClient({
|
|
9
|
-
context: options.context
|
|
10
|
-
});
|
|
11
|
-
const emptyData = Symbol('empty');
|
|
12
|
-
const defaultedOptions = queryClient.defaultQueryOptions(options);
|
|
13
|
-
defaultedOptions._optimisticResults = 'optimistic';
|
|
14
|
-
const observer = new Observer(queryClient, defaultedOptions);
|
|
15
|
-
const [state, setState] = createStore( // @ts-ignore
|
|
16
|
-
observer.getOptimisticResult(defaultedOptions));
|
|
17
|
-
const [dataResource, {
|
|
18
|
-
refetch,
|
|
19
|
-
mutate
|
|
20
|
-
}] = createResource(() => {
|
|
21
|
-
return new Promise(resolve => {
|
|
22
|
-
if (!(state.isFetching && state.isLoading)) {
|
|
23
|
-
if (unwrap(state.data) === emptyData) {
|
|
24
|
-
resolve(undefined);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
resolve(unwrap(state.data));
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
batch(() => {
|
|
32
|
-
mutate(() => unwrap(state.data));
|
|
33
|
-
refetch();
|
|
34
|
-
});
|
|
35
|
-
let taskQueue = [];
|
|
36
|
-
const unsubscribe = observer.subscribe(result => {
|
|
37
|
-
taskQueue.push(() => {
|
|
38
|
-
batch(() => {
|
|
39
|
-
const unwrappedResult = { ...unwrap(result)
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
if (unwrappedResult.data === undefined) {
|
|
43
|
-
// This is a hack to prevent Solid
|
|
44
|
-
// from deleting the data property when it is `undefined`
|
|
45
|
-
// ref: https://www.solidjs.com/docs/latest/api#updating-stores
|
|
46
|
-
// @ts-ignore
|
|
47
|
-
unwrappedResult.data = emptyData;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
setState(unwrap(unwrappedResult));
|
|
51
|
-
mutate(() => unwrap(result.data));
|
|
52
|
-
refetch();
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
queueMicrotask(() => {
|
|
56
|
-
const taskToRun = taskQueue.pop();
|
|
57
|
-
|
|
58
|
-
if (taskToRun) {
|
|
59
|
-
taskToRun();
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
taskQueue = [];
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
onCleanup(() => unsubscribe());
|
|
66
|
-
onMount(() => {
|
|
67
|
-
observer.setOptions(defaultedOptions, {
|
|
68
|
-
listeners: false
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
createComputed(() => {
|
|
72
|
-
const newDefaultedOptions = queryClient.defaultQueryOptions(options);
|
|
73
|
-
observer.setOptions(newDefaultedOptions);
|
|
74
|
-
});
|
|
75
|
-
createComputed(on(() => state.status, () => {
|
|
76
|
-
if (state.isError && !state.isFetching && shouldThrowError(observer.options.useErrorBoundary, [state.error, observer.getCurrentQuery()])) {
|
|
77
|
-
throw state.error;
|
|
78
|
-
}
|
|
79
|
-
}));
|
|
80
|
-
const handler = {
|
|
81
|
-
get(target, prop) {
|
|
82
|
-
if (prop === 'data') {
|
|
83
|
-
return dataResource();
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return Reflect.get(target, prop);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
};
|
|
90
|
-
return new Proxy(state, handler);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export { createBaseQuery };
|
|
94
|
-
//# sourceMappingURL=createBaseQuery.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createBaseQuery.esm.js","sources":["../../src/createBaseQuery.ts"],"sourcesContent":["import {\n batch,\n createComputed,\n createResource,\n on,\n onCleanup,\n onMount,\n} from 'solid-js'\nimport { createStore, unwrap } from 'solid-js/store'\nimport { useQueryClient } from './QueryClientProvider'\nimport { shouldThrowError } from './utils'\nimport type { QueryObserver } from '@tanstack/query-core'\nimport type { QueryKey, QueryObserverResult } from '@tanstack/query-core'\nimport type { CreateBaseQueryOptions } from './types'\n\n// Base Query Function that is used to create the query.\nexport function createBaseQuery<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n options: CreateBaseQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n Observer: typeof QueryObserver,\n): QueryObserverResult<TData, TError> {\n const queryClient = useQueryClient({ context: options.context })\n const emptyData = Symbol('empty')\n const defaultedOptions = queryClient.defaultQueryOptions(options)\n defaultedOptions._optimisticResults = 'optimistic'\n const observer = new Observer(queryClient, defaultedOptions)\n\n const [state, setState] = createStore<QueryObserverResult<TData, TError>>(\n // @ts-ignore\n observer.getOptimisticResult(defaultedOptions),\n )\n\n const [dataResource, { refetch, mutate }] = createResource<TData | undefined>(\n () => {\n return new Promise((resolve) => {\n if (!(state.isFetching && state.isLoading)) {\n if (unwrap(state.data) === emptyData) {\n resolve(undefined)\n }\n resolve(unwrap(state.data))\n }\n })\n },\n )\n\n batch(() => {\n mutate(() => unwrap(state.data))\n refetch()\n })\n\n let taskQueue: Array<() => void> = []\n\n const unsubscribe = observer.subscribe((result) => {\n taskQueue.push(() => {\n batch(() => {\n const unwrappedResult = { ...unwrap(result) }\n if (unwrappedResult.data === undefined) {\n // This is a hack to prevent Solid\n // from deleting the data property when it is `undefined`\n // ref: https://www.solidjs.com/docs/latest/api#updating-stores\n // @ts-ignore\n unwrappedResult.data = emptyData\n }\n setState(unwrap(unwrappedResult))\n mutate(() => unwrap(result.data))\n refetch()\n })\n })\n\n queueMicrotask(() => {\n const taskToRun = taskQueue.pop()\n if (taskToRun) {\n taskToRun()\n }\n taskQueue = []\n })\n })\n\n onCleanup(() => unsubscribe())\n\n onMount(() => {\n observer.setOptions(defaultedOptions, { listeners: false })\n })\n\n createComputed(() => {\n const newDefaultedOptions = queryClient.defaultQueryOptions(options)\n observer.setOptions(newDefaultedOptions)\n })\n\n createComputed(\n on(\n () => state.status,\n () => {\n if (\n state.isError &&\n !state.isFetching &&\n shouldThrowError(observer.options.useErrorBoundary, [\n state.error,\n observer.getCurrentQuery(),\n ])\n ) {\n throw state.error\n }\n },\n ),\n )\n\n const handler = {\n get(\n target: QueryObserverResult<TData, TError>,\n prop: keyof QueryObserverResult<TData, TError>,\n ): any {\n if (prop === 'data') {\n return dataResource()\n }\n return Reflect.get(target, prop)\n },\n }\n\n return new Proxy(state, handler) as QueryObserverResult<TData, TError>\n}\n"],"names":["createBaseQuery","options","Observer","queryClient","useQueryClient","context","emptyData","Symbol","defaultedOptions","defaultQueryOptions","_optimisticResults","observer","state","setState","createStore","getOptimisticResult","dataResource","refetch","mutate","createResource","Promise","resolve","isFetching","isLoading","unwrap","data","undefined","batch","taskQueue","unsubscribe","subscribe","result","push","unwrappedResult","queueMicrotask","taskToRun","pop","onCleanup","onMount","setOptions","listeners","createComputed","newDefaultedOptions","on","status","isError","shouldThrowError","useErrorBoundary","error","getCurrentQuery","handler","get","target","prop","Reflect","Proxy"],"mappings":";;;;;AAeA;AACO,SAASA,eAAT,CAOLC,OAPK,EAcLC,QAdK,EAe+B;EACpC,MAAMC,WAAW,GAAGC,cAAc,CAAC;IAAEC,OAAO,EAAEJ,OAAO,CAACI,OAAAA;AAAnB,GAAD,CAAlC,CAAA;AACA,EAAA,MAAMC,SAAS,GAAGC,MAAM,CAAC,OAAD,CAAxB,CAAA;AACA,EAAA,MAAMC,gBAAgB,GAAGL,WAAW,CAACM,mBAAZ,CAAgCR,OAAhC,CAAzB,CAAA;EACAO,gBAAgB,CAACE,kBAAjB,GAAsC,YAAtC,CAAA;EACA,MAAMC,QAAQ,GAAG,IAAIT,QAAJ,CAAaC,WAAb,EAA0BK,gBAA1B,CAAjB,CAAA;AAEA,EAAA,MAAM,CAACI,KAAD,EAAQC,QAAR,CAAA,GAAoBC,WAAW;AAEnCH,EAAAA,QAAQ,CAACI,mBAAT,CAA6BP,gBAA7B,CAFmC,CAArC,CAAA;EAKA,MAAM,CAACQ,YAAD,EAAe;IAAEC,OAAF;AAAWC,IAAAA,MAAAA;GAA1B,CAAA,GAAsCC,cAAc,CACxD,MAAM;AACJ,IAAA,OAAO,IAAIC,OAAJ,CAAaC,OAAD,IAAa;MAC9B,IAAI,EAAET,KAAK,CAACU,UAAN,IAAoBV,KAAK,CAACW,SAA5B,CAAJ,EAA4C;QAC1C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';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var solidJs = require('solid-js');
|
|
6
|
-
var store = require('solid-js/store');
|
|
7
|
-
var QueryClientProvider = require('./QueryClientProvider.js');
|
|
8
|
-
var utils = require('./utils.js');
|
|
9
|
-
|
|
10
|
-
// Base Query Function that is used to create the query.
|
|
11
|
-
function createBaseQuery(options, Observer) {
|
|
12
|
-
const queryClient = QueryClientProvider.useQueryClient({
|
|
13
|
-
context: options.context
|
|
14
|
-
});
|
|
15
|
-
const emptyData = Symbol('empty');
|
|
16
|
-
const defaultedOptions = queryClient.defaultQueryOptions(options);
|
|
17
|
-
defaultedOptions._optimisticResults = 'optimistic';
|
|
18
|
-
const observer = new Observer(queryClient, defaultedOptions);
|
|
19
|
-
const [state, setState] = store.createStore( // @ts-ignore
|
|
20
|
-
observer.getOptimisticResult(defaultedOptions));
|
|
21
|
-
const [dataResource, {
|
|
22
|
-
refetch,
|
|
23
|
-
mutate
|
|
24
|
-
}] = solidJs.createResource(() => {
|
|
25
|
-
return new Promise(resolve => {
|
|
26
|
-
if (!(state.isFetching && state.isLoading)) {
|
|
27
|
-
if (store.unwrap(state.data) === emptyData) {
|
|
28
|
-
resolve(undefined);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
resolve(store.unwrap(state.data));
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
solidJs.batch(() => {
|
|
36
|
-
mutate(() => store.unwrap(state.data));
|
|
37
|
-
refetch();
|
|
38
|
-
});
|
|
39
|
-
let taskQueue = [];
|
|
40
|
-
const unsubscribe = observer.subscribe(result => {
|
|
41
|
-
taskQueue.push(() => {
|
|
42
|
-
solidJs.batch(() => {
|
|
43
|
-
const unwrappedResult = { ...store.unwrap(result)
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
if (unwrappedResult.data === undefined) {
|
|
47
|
-
// This is a hack to prevent Solid
|
|
48
|
-
// from deleting the data property when it is `undefined`
|
|
49
|
-
// ref: https://www.solidjs.com/docs/latest/api#updating-stores
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
unwrappedResult.data = emptyData;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
setState(store.unwrap(unwrappedResult));
|
|
55
|
-
mutate(() => store.unwrap(result.data));
|
|
56
|
-
refetch();
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
queueMicrotask(() => {
|
|
60
|
-
const taskToRun = taskQueue.pop();
|
|
61
|
-
|
|
62
|
-
if (taskToRun) {
|
|
63
|
-
taskToRun();
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
taskQueue = [];
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
solidJs.onCleanup(() => unsubscribe());
|
|
70
|
-
solidJs.onMount(() => {
|
|
71
|
-
observer.setOptions(defaultedOptions, {
|
|
72
|
-
listeners: false
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
solidJs.createComputed(() => {
|
|
76
|
-
const newDefaultedOptions = queryClient.defaultQueryOptions(options);
|
|
77
|
-
observer.setOptions(newDefaultedOptions);
|
|
78
|
-
});
|
|
79
|
-
solidJs.createComputed(solidJs.on(() => state.status, () => {
|
|
80
|
-
if (state.isError && !state.isFetching && utils.shouldThrowError(observer.options.useErrorBoundary, [state.error, observer.getCurrentQuery()])) {
|
|
81
|
-
throw state.error;
|
|
82
|
-
}
|
|
83
|
-
}));
|
|
84
|
-
const handler = {
|
|
85
|
-
get(target, prop) {
|
|
86
|
-
if (prop === 'data') {
|
|
87
|
-
return dataResource();
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return Reflect.get(target, prop);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
};
|
|
94
|
-
return new Proxy(state, handler);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
exports.createBaseQuery = createBaseQuery;
|
|
98
|
-
//# sourceMappingURL=createBaseQuery.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createBaseQuery.js","sources":["../../src/createBaseQuery.ts"],"sourcesContent":["import {\n batch,\n createComputed,\n createResource,\n on,\n onCleanup,\n onMount,\n} from 'solid-js'\nimport { createStore, unwrap } from 'solid-js/store'\nimport { useQueryClient } from './QueryClientProvider'\nimport { shouldThrowError } from './utils'\nimport type { QueryObserver } from '@tanstack/query-core'\nimport type { QueryKey, QueryObserverResult } from '@tanstack/query-core'\nimport type { CreateBaseQueryOptions } from './types'\n\n// Base Query Function that is used to create the query.\nexport function createBaseQuery<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n options: CreateBaseQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n Observer: typeof QueryObserver,\n): QueryObserverResult<TData, TError> {\n const queryClient = useQueryClient({ context: options.context })\n const emptyData = Symbol('empty')\n const defaultedOptions = queryClient.defaultQueryOptions(options)\n defaultedOptions._optimisticResults = 'optimistic'\n const observer = new Observer(queryClient, defaultedOptions)\n\n const [state, setState] = createStore<QueryObserverResult<TData, TError>>(\n // @ts-ignore\n observer.getOptimisticResult(defaultedOptions),\n )\n\n const [dataResource, { refetch, mutate }] = createResource<TData | undefined>(\n () => {\n return new Promise((resolve) => {\n if (!(state.isFetching && state.isLoading)) {\n if (unwrap(state.data) === emptyData) {\n resolve(undefined)\n }\n resolve(unwrap(state.data))\n }\n })\n },\n )\n\n batch(() => {\n mutate(() => unwrap(state.data))\n refetch()\n })\n\n let taskQueue: Array<() => void> = []\n\n const unsubscribe = observer.subscribe((result) => {\n taskQueue.push(() => {\n batch(() => {\n const unwrappedResult = { ...unwrap(result) }\n if (unwrappedResult.data === undefined) {\n // This is a hack to prevent Solid\n // from deleting the data property when it is `undefined`\n // ref: https://www.solidjs.com/docs/latest/api#updating-stores\n // @ts-ignore\n unwrappedResult.data = emptyData\n }\n setState(unwrap(unwrappedResult))\n mutate(() => unwrap(result.data))\n refetch()\n })\n })\n\n queueMicrotask(() => {\n const taskToRun = taskQueue.pop()\n if (taskToRun) {\n taskToRun()\n }\n taskQueue = []\n })\n })\n\n onCleanup(() => unsubscribe())\n\n onMount(() => {\n observer.setOptions(defaultedOptions, { listeners: false })\n })\n\n createComputed(() => {\n const newDefaultedOptions = queryClient.defaultQueryOptions(options)\n observer.setOptions(newDefaultedOptions)\n })\n\n createComputed(\n on(\n () => state.status,\n () => {\n if (\n state.isError &&\n !state.isFetching &&\n shouldThrowError(observer.options.useErrorBoundary, [\n state.error,\n observer.getCurrentQuery(),\n ])\n ) {\n throw state.error\n }\n },\n ),\n )\n\n const handler = {\n get(\n target: QueryObserverResult<TData, TError>,\n prop: keyof QueryObserverResult<TData, TError>,\n ): any {\n if (prop === 'data') {\n return dataResource()\n }\n return Reflect.get(target, prop)\n },\n }\n\n return new Proxy(state, handler) as QueryObserverResult<TData, TError>\n}\n"],"names":["createBaseQuery","options","Observer","queryClient","useQueryClient","context","emptyData","Symbol","defaultedOptions","defaultQueryOptions","_optimisticResults","observer","state","setState","createStore","getOptimisticResult","dataResource","refetch","mutate","createResource","Promise","resolve","isFetching","isLoading","unwrap","data","undefined","batch","taskQueue","unsubscribe","subscribe","result","push","unwrappedResult","queueMicrotask","taskToRun","pop","onCleanup","onMount","setOptions","listeners","createComputed","newDefaultedOptions","on","status","isError","shouldThrowError","useErrorBoundary","error","getCurrentQuery","handler","get","target","prop","Reflect","Proxy"],"mappings":";;;;;;;;;AAeA;AACO,SAASA,eAAT,CAOLC,OAPK,EAcLC,QAdK,EAe+B;EACpC,MAAMC,WAAW,GAAGC,kCAAc,CAAC;IAAEC,OAAO,EAAEJ,OAAO,CAACI,OAAAA;AAAnB,GAAD,CAAlC,CAAA;AACA,EAAA,MAAMC,SAAS,GAAGC,MAAM,CAAC,OAAD,CAAxB,CAAA;AACA,EAAA,MAAMC,gBAAgB,GAAGL,WAAW,CAACM,mBAAZ,CAAgCR,OAAhC,CAAzB,CAAA;E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