@tanstack/solid-query 4.13.0 → 4.14.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/build/lib/QueryClientProvider.esm.js +7 -1
- package/build/lib/QueryClientProvider.esm.js.map +1 -1
- package/build/lib/QueryClientProvider.js +7 -1
- package/build/lib/QueryClientProvider.js.map +1 -1
- package/build/lib/QueryClientProvider.mjs +7 -1
- package/build/lib/QueryClientProvider.mjs.map +1 -1
- package/build/solid/QueryClientProvider.jsx +8 -1
- package/build/solid/__tests__/createQuery.test.jsx +12 -8
- package/build/umd/index.development.js +19 -6
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/QueryClientProvider.tsx +11 -1
- package/src/__tests__/createQuery.test.tsx +21 -9
|
@@ -40,7 +40,13 @@ const QueryClientProvider = props => {
|
|
|
40
40
|
const mergedProps = mergeProps({
|
|
41
41
|
contextSharing: false
|
|
42
42
|
}, props);
|
|
43
|
-
onMount(() =>
|
|
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
|
+
});
|
|
44
50
|
onCleanup(() => mergedProps.client.unmount());
|
|
45
51
|
const QueryClientContext = getQueryClientContext(mergedProps.context, mergedProps.contextSharing);
|
|
46
52
|
return createComponent(QueryClientSharingContext.Provider, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryClientProvider.esm.js","sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["import type { QueryClient } from '@tanstack/query-core'\nimport type { Context, JSX } from 'solid-js'\nimport {\n createContext,\n useContext,\n onMount,\n onCleanup,\n mergeProps,\n} 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(() => mergedProps.client.mount())\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","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;
|
|
1
|
+
{"version":3,"file":"QueryClientProvider.esm.js","sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["import type { QueryClient } from '@tanstack/query-core'\nimport type { Context, JSX } from 'solid-js'\nimport {\n createContext,\n useContext,\n onMount,\n onCleanup,\n mergeProps,\n} 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;;;;"}
|
|
@@ -44,7 +44,13 @@ const QueryClientProvider = props => {
|
|
|
44
44
|
const mergedProps = solidJs.mergeProps({
|
|
45
45
|
contextSharing: false
|
|
46
46
|
}, props);
|
|
47
|
-
solidJs.onMount(() =>
|
|
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
|
+
});
|
|
48
54
|
solidJs.onCleanup(() => mergedProps.client.unmount());
|
|
49
55
|
const QueryClientContext = getQueryClientContext(mergedProps.context, mergedProps.contextSharing);
|
|
50
56
|
return solidJs.createComponent(QueryClientSharingContext.Provider, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryClientProvider.js","sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["import type { QueryClient } from '@tanstack/query-core'\nimport type { Context, JSX } from 'solid-js'\nimport {\n createContext,\n useContext,\n onMount,\n onCleanup,\n mergeProps,\n} 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(() => mergedProps.client.mount())\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","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,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,kBAAU,CAC5BP,qBAAqB,CAACC,OAAD,EAAUM,kBAAU,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,kBAAU,CAC5B;AACEV,IAAAA,cAAc,EAAE,KAAA;GAFU,EAI5BQ,KAJ4B,CAA9B,CAAA;
|
|
1
|
+
{"version":3,"file":"QueryClientProvider.js","sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["import type { QueryClient } from '@tanstack/query-core'\nimport type { Context, JSX } from 'solid-js'\nimport {\n createContext,\n useContext,\n onMount,\n onCleanup,\n mergeProps,\n} 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,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,kBAAU,CAC5BP,qBAAqB,CAACC,OAAD,EAAUM,kBAAU,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,kBAAU,CAC5B;AACEV,IAAAA,cAAc,EAAE,KAAA;GAFU,EAI5BQ,KAJ4B,CAA9B,CAAA;AAMAG,EAAAA,eAAO,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,iBAAS,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,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;;;;;;"}
|
|
@@ -40,7 +40,13 @@ const QueryClientProvider = props => {
|
|
|
40
40
|
const mergedProps = mergeProps({
|
|
41
41
|
contextSharing: false
|
|
42
42
|
}, props);
|
|
43
|
-
onMount(() =>
|
|
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
|
+
});
|
|
44
50
|
onCleanup(() => mergedProps.client.unmount());
|
|
45
51
|
const QueryClientContext = getQueryClientContext(mergedProps.context, mergedProps.contextSharing);
|
|
46
52
|
return createComponent(QueryClientSharingContext.Provider, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryClientProvider.mjs","sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["import type { QueryClient } from '@tanstack/query-core'\nimport type { Context, JSX } from 'solid-js'\nimport {\n createContext,\n useContext,\n onMount,\n onCleanup,\n mergeProps,\n} 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(() => mergedProps.client.mount())\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","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;
|
|
1
|
+
{"version":3,"file":"QueryClientProvider.mjs","sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["import type { QueryClient } from '@tanstack/query-core'\nimport type { Context, JSX } from 'solid-js'\nimport {\n createContext,\n useContext,\n onMount,\n onCleanup,\n mergeProps,\n} 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;;;;"}
|
|
@@ -31,7 +31,14 @@ export const QueryClientProvider = (props) => {
|
|
|
31
31
|
const mergedProps = mergeProps({
|
|
32
32
|
contextSharing: false,
|
|
33
33
|
}, props);
|
|
34
|
-
onMount(() =>
|
|
34
|
+
onMount(() => {
|
|
35
|
+
mergedProps.client.mount();
|
|
36
|
+
if (process.env.NODE_ENV !== 'production' && mergedProps.contextSharing) {
|
|
37
|
+
mergedProps.client
|
|
38
|
+
.getLogger()
|
|
39
|
+
.error(`The contextSharing option has been deprecated and will be removed in the next major version`);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
35
42
|
onCleanup(() => mergedProps.client.unmount());
|
|
36
43
|
const QueryClientContext = getQueryClientContext(mergedProps.context, mergedProps.contextSharing);
|
|
37
44
|
return (<QueryClientSharingContext.Provider value={!mergedProps.context && mergedProps.contextSharing}>
|
|
@@ -1429,16 +1429,20 @@ describe('createQuery', () => {
|
|
|
1429
1429
|
createRenderEffect(() => {
|
|
1430
1430
|
states.push({ ...state });
|
|
1431
1431
|
});
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1432
|
+
return (<div>
|
|
1433
|
+
<h1>
|
|
1434
|
+
data: {state.data}, count: {count}, isFetching:{' '}
|
|
1435
|
+
{String(state.isFetching)}
|
|
1436
|
+
</h1>
|
|
1437
|
+
<button onClick={() => setCount(1)}>inc</button>
|
|
1438
|
+
</div>);
|
|
1438
1439
|
}
|
|
1439
1440
|
render(() => (<QueryClientProvider client={queryClient}>
|
|
1440
1441
|
<Page />
|
|
1441
1442
|
</QueryClientProvider>));
|
|
1443
|
+
await waitFor(() => screen.getByText('data: 0, count: 0, isFetching: false'));
|
|
1444
|
+
fireEvent.click(screen.getByRole('button', { name: 'inc' }));
|
|
1445
|
+
await waitFor(() => screen.getByText('data: 1, count: 1, isFetching: false'));
|
|
1442
1446
|
await waitFor(() => expect(states.length).toBe(4));
|
|
1443
1447
|
// Initial
|
|
1444
1448
|
expect(states[0]).toMatchObject({
|
|
@@ -1456,10 +1460,10 @@ describe('createQuery', () => {
|
|
|
1456
1460
|
});
|
|
1457
1461
|
// Set state
|
|
1458
1462
|
expect(states[2]).toMatchObject({
|
|
1459
|
-
data:
|
|
1463
|
+
data: 99,
|
|
1460
1464
|
isFetching: true,
|
|
1461
1465
|
isSuccess: true,
|
|
1462
|
-
isPreviousData:
|
|
1466
|
+
isPreviousData: false,
|
|
1463
1467
|
});
|
|
1464
1468
|
// New data
|
|
1465
1469
|
expect(states[3]).toMatchObject({
|
|
@@ -1232,9 +1232,8 @@
|
|
|
1232
1232
|
|
|
1233
1233
|
function getDefaultState$1(options) {
|
|
1234
1234
|
const data = typeof options.initialData === 'function' ? options.initialData() : options.initialData;
|
|
1235
|
-
const hasInitialData = typeof options.initialData !== 'undefined';
|
|
1236
|
-
const initialDataUpdatedAt = hasInitialData ? typeof options.initialDataUpdatedAt === 'function' ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;
|
|
1237
1235
|
const hasData = typeof data !== 'undefined';
|
|
1236
|
+
const initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === 'function' ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;
|
|
1238
1237
|
return {
|
|
1239
1238
|
data,
|
|
1240
1239
|
dataUpdateCount: 0,
|
|
@@ -1842,6 +1841,10 @@
|
|
|
1842
1841
|
this.defaultOptions = config.defaultOptions || {};
|
|
1843
1842
|
this.queryDefaults = [];
|
|
1844
1843
|
this.mutationDefaults = [];
|
|
1844
|
+
|
|
1845
|
+
if (config.logger) {
|
|
1846
|
+
this.logger.error("Passing a custom logger has been deprecated and will be removed in the next major version.");
|
|
1847
|
+
}
|
|
1845
1848
|
}
|
|
1846
1849
|
|
|
1847
1850
|
mount() {
|
|
@@ -2215,6 +2218,10 @@
|
|
|
2215
2218
|
const prevQuery = this.currentQuery;
|
|
2216
2219
|
this.options = this.client.defaultQueryOptions(options);
|
|
2217
2220
|
|
|
2221
|
+
if (typeof (options == null ? void 0 : options.isDataEqual) !== 'undefined') {
|
|
2222
|
+
this.client.getLogger().error("The isDataEqual option has been deprecated and will be removed in the next major version. You can achieve the same functionality by passing a function as the structuralSharing option");
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2218
2225
|
if (!shallowEqualObjects(prevOptions, this.options)) {
|
|
2219
2226
|
this.client.getQueryCache().notify({
|
|
2220
2227
|
type: 'observerOptionsUpdated',
|
|
@@ -2427,7 +2434,7 @@
|
|
|
2427
2434
|
} // Keep previous data if needed
|
|
2428
2435
|
|
|
2429
2436
|
|
|
2430
|
-
if (options.keepPreviousData && !state.
|
|
2437
|
+
if (options.keepPreviousData && !state.dataUpdatedAt && prevQueryResult != null && prevQueryResult.isSuccess && status !== 'error') {
|
|
2431
2438
|
data = prevQueryResult.data;
|
|
2432
2439
|
dataUpdatedAt = prevQueryResult.dataUpdatedAt;
|
|
2433
2440
|
status = prevQueryResult.status;
|
|
@@ -2469,7 +2476,6 @@
|
|
|
2469
2476
|
if (options.select && typeof placeholderData !== 'undefined') {
|
|
2470
2477
|
try {
|
|
2471
2478
|
placeholderData = options.select(placeholderData);
|
|
2472
|
-
placeholderData = replaceData(prevResult == null ? void 0 : prevResult.data, placeholderData, options);
|
|
2473
2479
|
this.selectError = null;
|
|
2474
2480
|
} catch (selectError) {
|
|
2475
2481
|
{
|
|
@@ -2483,7 +2489,7 @@
|
|
|
2483
2489
|
|
|
2484
2490
|
if (typeof placeholderData !== 'undefined') {
|
|
2485
2491
|
status = 'success';
|
|
2486
|
-
data = placeholderData;
|
|
2492
|
+
data = replaceData(prevResult == null ? void 0 : prevResult.data, placeholderData, options);
|
|
2487
2493
|
isPlaceholderData = true;
|
|
2488
2494
|
}
|
|
2489
2495
|
}
|
|
@@ -3213,7 +3219,13 @@
|
|
|
3213
3219
|
const mergedProps = solidJs.mergeProps({
|
|
3214
3220
|
contextSharing: false
|
|
3215
3221
|
}, props);
|
|
3216
|
-
solidJs.onMount(() =>
|
|
3222
|
+
solidJs.onMount(() => {
|
|
3223
|
+
mergedProps.client.mount();
|
|
3224
|
+
|
|
3225
|
+
if (mergedProps.contextSharing) {
|
|
3226
|
+
mergedProps.client.getLogger().error("The contextSharing option has been deprecated and will be removed in the next major version");
|
|
3227
|
+
}
|
|
3228
|
+
});
|
|
3217
3229
|
solidJs.onCleanup(() => mergedProps.client.unmount());
|
|
3218
3230
|
const QueryClientContext = getQueryClientContext(mergedProps.context, mergedProps.contextSharing);
|
|
3219
3231
|
return solidJs.createComponent(QueryClientSharingContext.Provider, {
|
|
@@ -3501,6 +3513,7 @@
|
|
|
3501
3513
|
exports.parseMutationArgs = parseMutationArgs;
|
|
3502
3514
|
exports.parseMutationFilterArgs = parseMutationFilterArgs;
|
|
3503
3515
|
exports.parseQueryArgs = parseQueryArgs$1;
|
|
3516
|
+
exports.replaceEqualDeep = replaceEqualDeep;
|
|
3504
3517
|
exports.useIsFetching = useIsFetching;
|
|
3505
3518
|
exports.useIsMutating = useIsMutating;
|
|
3506
3519
|
exports.useQueryClient = useQueryClient;
|