@tanstack/react-query 4.22.3 → 4.23.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/README.md ADDED
@@ -0,0 +1,51 @@
1
+ <img src="https://static.scarf.sh/a.png?x-pxid=be2d8a11-9712-4c1d-9963-580b2d4fb133" />
2
+
3
+ ![TanStack Query Header](https://github.com/TanStack/query/raw/beta/media/repo-header.png)
4
+
5
+ Hooks for fetching, caching and updating asynchronous data in React
6
+
7
+ <a href="https://twitter.com/intent/tweet?button_hashtag=TanStack" target="\_parent">
8
+ <img alt="#TanStack" src="https://img.shields.io/twitter/url?color=%2308a0e9&label=%23TanStack&style=social&url=https%3A%2F%2Ftwitter.com%2Fintent%2Ftweet%3Fbutton_hashtag%3DTanStack">
9
+ </a><a href="https://discord.com/invite/WrRKjPJ" target="\_parent">
10
+ <img alt="" src="https://img.shields.io/badge/Discord-TanStack-%235865F2" />
11
+ </a><a href="https://github.com/TanStack/query/actions?query=workflow%3A%22react-query+tests%22">
12
+ <img src="https://github.com/TanStack/query/workflows/react-query%20tests/badge.svg" />
13
+ </a><a href="https://www.npmjs.com/package/@tanstack/query-core" target="\_parent">
14
+ <img alt="" src="https://img.shields.io/npm/dm/@tanstack/query-core.svg" />
15
+ </a><a href="https://bundlephobia.com/package/@tanstack/react-query@latest" target="\_parent">
16
+ <img alt="" src="https://badgen.net/bundlephobia/minzip/@tanstack/react-query" />
17
+ </a><a href="#badge">
18
+ <img alt="semantic-release" src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg">
19
+ </a><a href="https://github.com/TanStack/query/discussions">
20
+ <img alt="Join the discussion on Github" src="https://img.shields.io/badge/Github%20Discussions%20%26%20Support-Chat%20now!-blue" />
21
+ </a><a href="https://bestofjs.org/projects/tanstack-query"><img alt="Best of JS" src="https://img.shields.io/endpoint?url=https://bestofjs-serverless.now.sh/api/project-badge?fullName=TanStack%2Fquery%26since=daily" /></a><a href="https://github.com/TanStack/query/" target="\_parent">
22
+ <img alt="" src="https://img.shields.io/github/stars/TanStack/query.svg?style=social&label=Star" />
23
+ </a><a href="https://twitter.com/tannerlinsley" target="\_parent">
24
+ <img alt="" src="https://img.shields.io/twitter/follow/tannerlinsley.svg?style=social&label=Follow" />
25
+ </a> <a href="https://gitpod.io/from-referrer/">
26
+ <img src="https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod" alt="Gitpod Ready-to-Code"/>
27
+ </a>
28
+
29
+ Enjoy this library? Try the entire [TanStack](https://tanstack.com)! [TanStack Table](https://github.com/TanStack/table), [TanStack Router](https://github.com/tanstack/router), [TanStack Virtual](https://github.com/tanstack/virtual), [React Charts](https://github.com/TanStack/react-charts), [React Ranger](https://github.com/TanStack/ranger)
30
+
31
+ ## Visit [tanstack.com/query](https://tanstack.com/query) for docs, guides, API and more!
32
+
33
+ ## Quick Features
34
+
35
+ - Transport/protocol/backend agnostic data fetching (REST, GraphQL, promises, whatever!)
36
+ - Auto Caching + Refetching (stale-while-revalidate, Window Refocus, Polling/Realtime)
37
+ - Parallel + Dependent Queries
38
+ - Mutations + Reactive Query Refetching
39
+ - Multi-layer Cache + Automatic Garbage Collection
40
+ - Paginated + Cursor-based Queries
41
+ - Load-More + Infinite Scroll Queries w/ Scroll Recovery
42
+ - Request Cancellation
43
+ - [React Suspense](https://reactjs.org/docs/concurrent-mode-suspense.html) + Fetch-As-You-Render Query Prefetching
44
+ - Dedicated Devtools
45
+ - <a href="https://bundlephobia.com/package/@tanstack/react-query@latest" target="\_parent">
46
+ <img alt="" src="https://badgen.net/bundlephobia/minzip/@tanstack/react-query" />
47
+ </a> (depending on features imported)
48
+
49
+ ### [Become a Sponsor!](https://github.com/sponsors/tannerlinsley/)
50
+
51
+ <!-- Use the force, Luke -->
@@ -1 +1 @@
1
- {"version":3,"file":"Hydrate.esm.js","sources":["../../src/Hydrate.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport type { HydrateOptions } from '@tanstack/query-core'\nimport { hydrate } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type { ContextOptions } from './types'\n\nexport function useHydrate(\n state: unknown,\n options: HydrateOptions & ContextOptions = {},\n) {\n const queryClient = useQueryClient({ context: options.context })\n\n const optionsRef = React.useRef(options)\n optionsRef.current = options\n\n // Running hydrate again with the same queries is safe,\n // it wont overwrite or initialize existing queries,\n // relying on useMemo here is only a performance optimization.\n // hydrate can and should be run *during* render here for SSR to work properly\n React.useMemo(() => {\n if (state) {\n hydrate(queryClient, state, optionsRef.current)\n }\n }, [queryClient, state])\n}\n\nexport interface HydrateProps {\n state?: unknown\n options?: HydrateOptions\n children?: React.ReactNode\n}\n\nexport const Hydrate = ({ children, options, state }: HydrateProps) => {\n useHydrate(state, options)\n return children as React.ReactElement\n}\n"],"names":["useHydrate","state","options","queryClient","useQueryClient","context","optionsRef","React","useRef","current","useMemo","hydrate","Hydrate","children"],"mappings":";;;;AAOO,SAASA,UAAT,CACLC,KADK,EAELC,OAAwC,GAAG,EAFtC,EAGL;EACA,MAAMC,WAAW,GAAGC,cAAc,CAAC;IAAEC,OAAO,EAAEH,OAAO,CAACG,OAAAA;AAAnB,GAAD,CAAlC,CAAA;AAEA,EAAA,MAAMC,UAAU,GAAGC,KAAK,CAACC,MAAN,CAAaN,OAAb,CAAnB,CAAA;AACAI,EAAAA,UAAU,CAACG,OAAX,GAAqBP,OAArB,CAJA;AAOA;AACA;AACA;;EACAK,KAAK,CAACG,OAAN,CAAc,MAAM;AAClB,IAAA,IAAIT,KAAJ,EAAW;MACTU,OAAO,CAACR,WAAD,EAAcF,KAAd,EAAqBK,UAAU,CAACG,OAAhC,CAAP,CAAA;AACD,KAAA;AACF,GAJD,EAIG,CAACN,WAAD,EAAcF,KAAd,CAJH,CAAA,CAAA;AAKD,CAAA;AAQM,MAAMW,OAAO,GAAG,CAAC;EAAEC,QAAF;EAAYX,OAAZ;AAAqBD,EAAAA,KAAAA;AAArB,CAAD,KAAgD;AACrED,EAAAA,UAAU,CAACC,KAAD,EAAQC,OAAR,CAAV,CAAA;AACA,EAAA,OAAOW,QAAP,CAAA;AACD;;;;"}
1
+ {"version":3,"file":"Hydrate.esm.js","sources":["../../src/Hydrate.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport type { HydrateOptions } from '@tanstack/query-core'\nimport { hydrate } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type { ContextOptions } from './types'\n\nexport function useHydrate(\n state: unknown,\n options: HydrateOptions & ContextOptions = {},\n) {\n const queryClient = useQueryClient({ context: options.context })\n\n const optionsRef = React.useRef(options)\n optionsRef.current = options\n\n // Running hydrate again with the same queries is safe,\n // it wont overwrite or initialize existing queries,\n // relying on useMemo here is only a performance optimization.\n // hydrate can and should be run *during* render here for SSR to work properly\n React.useMemo(() => {\n if (state) {\n hydrate(queryClient, state, optionsRef.current)\n }\n }, [queryClient, state])\n}\n\nexport interface HydrateProps {\n state?: unknown\n options?: HydrateOptions\n children?: React.ReactNode\n}\n\nexport const Hydrate = ({ children, options, state }: HydrateProps) => {\n useHydrate(state, options)\n return children as React.ReactElement\n}\n"],"names":["useHydrate","state","options","queryClient","useQueryClient","context","optionsRef","React","useRef","current","useMemo","hydrate","Hydrate","children"],"mappings":";;;;AAQO,SAASA,UAAT,CACLC,KADK,EAELC,OAAwC,GAAG,EAFtC,EAGL;EACA,MAAMC,WAAW,GAAGC,cAAc,CAAC;IAAEC,OAAO,EAAEH,OAAO,CAACG,OAAAA;AAAnB,GAAD,CAAlC,CAAA;AAEA,EAAA,MAAMC,UAAU,GAAGC,KAAK,CAACC,MAAN,CAAaN,OAAb,CAAnB,CAAA;AACAI,EAAAA,UAAU,CAACG,OAAX,GAAqBP,OAArB,CAJA;AAOA;AACA;AACA;;EACAK,KAAK,CAACG,OAAN,CAAc,MAAM;AAClB,IAAA,IAAIT,KAAJ,EAAW;MACTU,OAAO,CAACR,WAAD,EAAcF,KAAd,EAAqBK,UAAU,CAACG,OAAhC,CAAP,CAAA;AACD,KAAA;AACF,GAJD,EAIG,CAACN,WAAD,EAAcF,KAAd,CAJH,CAAA,CAAA;AAKD,CAAA;AAQM,MAAMW,OAAO,GAAG,CAAC;EAAEC,QAAF;EAAYX,OAAZ;AAAqBD,EAAAA,KAAAA;AAArB,CAAD,KAAgD;AACrED,EAAAA,UAAU,CAACC,KAAD,EAAQC,OAAR,CAAV,CAAA;AACA,EAAA,OAAOW,QAAP,CAAA;AACD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Hydrate.js","sources":["../../src/Hydrate.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport type { HydrateOptions } from '@tanstack/query-core'\nimport { hydrate } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type { ContextOptions } from './types'\n\nexport function useHydrate(\n state: unknown,\n options: HydrateOptions & ContextOptions = {},\n) {\n const queryClient = useQueryClient({ context: options.context })\n\n const optionsRef = React.useRef(options)\n optionsRef.current = options\n\n // Running hydrate again with the same queries is safe,\n // it wont overwrite or initialize existing queries,\n // relying on useMemo here is only a performance optimization.\n // hydrate can and should be run *during* render here for SSR to work properly\n React.useMemo(() => {\n if (state) {\n hydrate(queryClient, state, optionsRef.current)\n }\n }, [queryClient, state])\n}\n\nexport interface HydrateProps {\n state?: unknown\n options?: HydrateOptions\n children?: React.ReactNode\n}\n\nexport const Hydrate = ({ children, options, state }: HydrateProps) => {\n useHydrate(state, options)\n return children as React.ReactElement\n}\n"],"names":["useHydrate","state","options","queryClient","useQueryClient","context","optionsRef","React","useRef","current","useMemo","hydrate","Hydrate","children"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOO,SAASA,UAAT,CACLC,KADK,EAELC,OAAwC,GAAG,EAFtC,EAGL;EACA,MAAMC,WAAW,GAAGC,kCAAc,CAAC;IAAEC,OAAO,EAAEH,OAAO,CAACG,OAAAA;AAAnB,GAAD,CAAlC,CAAA;AAEA,EAAA,MAAMC,UAAU,GAAGC,gBAAK,CAACC,MAAN,CAAaN,OAAb,CAAnB,CAAA;AACAI,EAAAA,UAAU,CAACG,OAAX,GAAqBP,OAArB,CAJA;AAOA;AACA;AACA;;EACAK,gBAAK,CAACG,OAAN,CAAc,MAAM;AAClB,IAAA,IAAIT,KAAJ,EAAW;MACTU,iBAAO,CAACR,WAAD,EAAcF,KAAd,EAAqBK,UAAU,CAACG,OAAhC,CAAP,CAAA;AACD,KAAA;AACF,GAJD,EAIG,CAACN,WAAD,EAAcF,KAAd,CAJH,CAAA,CAAA;AAKD,CAAA;AAQM,MAAMW,OAAO,GAAG,CAAC;EAAEC,QAAF;EAAYX,OAAZ;AAAqBD,EAAAA,KAAAA;AAArB,CAAD,KAAgD;AACrED,EAAAA,UAAU,CAACC,KAAD,EAAQC,OAAR,CAAV,CAAA;AACA,EAAA,OAAOW,QAAP,CAAA;AACD;;;;;"}
1
+ {"version":3,"file":"Hydrate.js","sources":["../../src/Hydrate.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport type { HydrateOptions } from '@tanstack/query-core'\nimport { hydrate } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type { ContextOptions } from './types'\n\nexport function useHydrate(\n state: unknown,\n options: HydrateOptions & ContextOptions = {},\n) {\n const queryClient = useQueryClient({ context: options.context })\n\n const optionsRef = React.useRef(options)\n optionsRef.current = options\n\n // Running hydrate again with the same queries is safe,\n // it wont overwrite or initialize existing queries,\n // relying on useMemo here is only a performance optimization.\n // hydrate can and should be run *during* render here for SSR to work properly\n React.useMemo(() => {\n if (state) {\n hydrate(queryClient, state, optionsRef.current)\n }\n }, [queryClient, state])\n}\n\nexport interface HydrateProps {\n state?: unknown\n options?: HydrateOptions\n children?: React.ReactNode\n}\n\nexport const Hydrate = ({ children, options, state }: HydrateProps) => {\n useHydrate(state, options)\n return children as React.ReactElement\n}\n"],"names":["useHydrate","state","options","queryClient","useQueryClient","context","optionsRef","React","useRef","current","useMemo","hydrate","Hydrate","children"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQO,SAASA,UAAT,CACLC,KADK,EAELC,OAAwC,GAAG,EAFtC,EAGL;EACA,MAAMC,WAAW,GAAGC,kCAAc,CAAC;IAAEC,OAAO,EAAEH,OAAO,CAACG,OAAAA;AAAnB,GAAD,CAAlC,CAAA;AAEA,EAAA,MAAMC,UAAU,GAAGC,gBAAK,CAACC,MAAN,CAAaN,OAAb,CAAnB,CAAA;AACAI,EAAAA,UAAU,CAACG,OAAX,GAAqBP,OAArB,CAJA;AAOA;AACA;AACA;;EACAK,gBAAK,CAACG,OAAN,CAAc,MAAM;AAClB,IAAA,IAAIT,KAAJ,EAAW;MACTU,iBAAO,CAACR,WAAD,EAAcF,KAAd,EAAqBK,UAAU,CAACG,OAAhC,CAAP,CAAA;AACD,KAAA;AACF,GAJD,EAIG,CAACN,WAAD,EAAcF,KAAd,CAJH,CAAA,CAAA;AAKD,CAAA;AAQM,MAAMW,OAAO,GAAG,CAAC;EAAEC,QAAF;EAAYX,OAAZ;AAAqBD,EAAAA,KAAAA;AAArB,CAAD,KAAgD;AACrED,EAAAA,UAAU,CAACC,KAAD,EAAQC,OAAR,CAAV,CAAA;AACA,EAAA,OAAOW,QAAP,CAAA;AACD;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Hydrate.mjs","sources":["../../src/Hydrate.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport type { HydrateOptions } from '@tanstack/query-core'\nimport { hydrate } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type { ContextOptions } from './types'\n\nexport function useHydrate(\n state: unknown,\n options: HydrateOptions & ContextOptions = {},\n) {\n const queryClient = useQueryClient({ context: options.context })\n\n const optionsRef = React.useRef(options)\n optionsRef.current = options\n\n // Running hydrate again with the same queries is safe,\n // it wont overwrite or initialize existing queries,\n // relying on useMemo here is only a performance optimization.\n // hydrate can and should be run *during* render here for SSR to work properly\n React.useMemo(() => {\n if (state) {\n hydrate(queryClient, state, optionsRef.current)\n }\n }, [queryClient, state])\n}\n\nexport interface HydrateProps {\n state?: unknown\n options?: HydrateOptions\n children?: React.ReactNode\n}\n\nexport const Hydrate = ({ children, options, state }: HydrateProps) => {\n useHydrate(state, options)\n return children as React.ReactElement\n}\n"],"names":["useHydrate","state","options","queryClient","useQueryClient","context","optionsRef","React","useRef","current","useMemo","hydrate","Hydrate","children"],"mappings":";;;;AAOO,SAASA,UAAT,CACLC,KADK,EAELC,OAAwC,GAAG,EAFtC,EAGL;EACA,MAAMC,WAAW,GAAGC,cAAc,CAAC;IAAEC,OAAO,EAAEH,OAAO,CAACG,OAAAA;AAAnB,GAAD,CAAlC,CAAA;AAEA,EAAA,MAAMC,UAAU,GAAGC,KAAK,CAACC,MAAN,CAAaN,OAAb,CAAnB,CAAA;AACAI,EAAAA,UAAU,CAACG,OAAX,GAAqBP,OAArB,CAJA;AAOA;AACA;AACA;;EACAK,KAAK,CAACG,OAAN,CAAc,MAAM;AAClB,IAAA,IAAIT,KAAJ,EAAW;MACTU,OAAO,CAACR,WAAD,EAAcF,KAAd,EAAqBK,UAAU,CAACG,OAAhC,CAAP,CAAA;AACD,KAAA;AACF,GAJD,EAIG,CAACN,WAAD,EAAcF,KAAd,CAJH,CAAA,CAAA;AAKD,CAAA;AAQM,MAAMW,OAAO,GAAG,CAAC;EAAEC,QAAF;EAAYX,OAAZ;AAAqBD,EAAAA,KAAAA;AAArB,CAAD,KAAgD;AACrED,EAAAA,UAAU,CAACC,KAAD,EAAQC,OAAR,CAAV,CAAA;AACA,EAAA,OAAOW,QAAP,CAAA;AACD;;;;"}
1
+ {"version":3,"file":"Hydrate.mjs","sources":["../../src/Hydrate.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport type { HydrateOptions } from '@tanstack/query-core'\nimport { hydrate } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type { ContextOptions } from './types'\n\nexport function useHydrate(\n state: unknown,\n options: HydrateOptions & ContextOptions = {},\n) {\n const queryClient = useQueryClient({ context: options.context })\n\n const optionsRef = React.useRef(options)\n optionsRef.current = options\n\n // Running hydrate again with the same queries is safe,\n // it wont overwrite or initialize existing queries,\n // relying on useMemo here is only a performance optimization.\n // hydrate can and should be run *during* render here for SSR to work properly\n React.useMemo(() => {\n if (state) {\n hydrate(queryClient, state, optionsRef.current)\n }\n }, [queryClient, state])\n}\n\nexport interface HydrateProps {\n state?: unknown\n options?: HydrateOptions\n children?: React.ReactNode\n}\n\nexport const Hydrate = ({ children, options, state }: HydrateProps) => {\n useHydrate(state, options)\n return children as React.ReactElement\n}\n"],"names":["useHydrate","state","options","queryClient","useQueryClient","context","optionsRef","React","useRef","current","useMemo","hydrate","Hydrate","children"],"mappings":";;;;AAQO,SAASA,UAAT,CACLC,KADK,EAELC,OAAwC,GAAG,EAFtC,EAGL;EACA,MAAMC,WAAW,GAAGC,cAAc,CAAC;IAAEC,OAAO,EAAEH,OAAO,CAACG,OAAAA;AAAnB,GAAD,CAAlC,CAAA;AAEA,EAAA,MAAMC,UAAU,GAAGC,KAAK,CAACC,MAAN,CAAaN,OAAb,CAAnB,CAAA;AACAI,EAAAA,UAAU,CAACG,OAAX,GAAqBP,OAArB,CAJA;AAOA;AACA;AACA;;EACAK,KAAK,CAACG,OAAN,CAAc,MAAM;AAClB,IAAA,IAAIT,KAAJ,EAAW;MACTU,OAAO,CAACR,WAAD,EAAcF,KAAd,EAAqBK,UAAU,CAACG,OAAhC,CAAP,CAAA;AACD,KAAA;AACF,GAJD,EAIG,CAACN,WAAD,EAAcF,KAAd,CAJH,CAAA,CAAA;AAKD,CAAA;AAQM,MAAMW,OAAO,GAAG,CAAC;EAAEC,QAAF;EAAYX,OAAZ;AAAqBD,EAAAA,KAAAA;AAArB,CAAD,KAAgD;AACrED,EAAAA,UAAU,CAACC,KAAD,EAAQC,OAAR,CAAV,CAAA;AACA,EAAA,OAAOW,QAAP,CAAA;AACD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"QueryClientProvider.esm.js","sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport type { QueryClient } from '@tanstack/query-core'\nimport type { ContextOptions } from './types'\n\ndeclare global {\n interface Window {\n ReactQueryClientContext?: React.Context<QueryClient | undefined>\n }\n}\n\nexport const defaultContext = React.createContext<QueryClient | undefined>(\n undefined,\n)\nconst QueryClientSharingContext = React.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 React 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: React.Context<QueryClient | undefined> | undefined,\n contextSharing: boolean,\n) {\n if (context) {\n return context\n }\n if (contextSharing && typeof window !== 'undefined') {\n if (!window.ReactQueryClientContext) {\n window.ReactQueryClientContext = defaultContext\n }\n\n return window.ReactQueryClientContext\n }\n\n return defaultContext\n}\n\nexport const useQueryClient = ({ context }: ContextOptions = {}) => {\n const queryClient = React.useContext(\n getQueryClientContext(context, React.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?: React.ReactNode\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 client,\n children,\n context,\n contextSharing = false,\n}: QueryClientProviderProps): JSX.Element => {\n React.useEffect(() => {\n client.mount()\n return () => {\n client.unmount()\n }\n }, [client])\n\n if (process.env.NODE_ENV !== 'production' && contextSharing) {\n 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 const Context = getQueryClientContext(context, contextSharing)\n\n return (\n <QueryClientSharingContext.Provider value={!context && contextSharing}>\n <Context.Provider value={client}>{children}</Context.Provider>\n </QueryClientSharingContext.Provider>\n )\n}\n"],"names":["defaultContext","React","createContext","undefined","QueryClientSharingContext","getQueryClientContext","context","contextSharing","window","ReactQueryClientContext","useQueryClient","queryClient","useContext","Error","QueryClientProvider","client","children","useEffect","mount","unmount","process","env","NODE_ENV","getLogger","error","Context"],"mappings":";;AAWO,MAAMA,cAAc,gBAAGC,KAAK,CAACC,aAAN,CAC5BC,SAD4B,EAAvB;AAGP,MAAMC,yBAAyB,gBAAGH,KAAK,CAACC,aAAN,CAA6B,KAA7B,CAAlC;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,GAAiCT,cAAjC,CAAA;AACD,KAAA;;IAED,OAAOQ,MAAM,CAACC,uBAAd,CAAA;AACD,GAAA;;AAED,EAAA,OAAOT,cAAP,CAAA;AACD,CAAA;;AAEM,MAAMU,cAAc,GAAG,CAAC;AAAEJ,EAAAA,OAAAA;AAAF,CAAA,GAA8B,EAA/B,KAAsC;AAClE,EAAA,MAAMK,WAAW,GAAGV,KAAK,CAACW,UAAN,CAClBP,qBAAqB,CAACC,OAAD,EAAUL,KAAK,CAACW,UAAN,CAAiBR,yBAAjB,CAAV,CADH,CAApB,CAAA;;EAIA,IAAI,CAACO,WAAL,EAAkB;AAChB,IAAA,MAAM,IAAIE,KAAJ,CAAU,wDAAV,CAAN,CAAA;AACD,GAAA;;AAED,EAAA,OAAOF,WAAP,CAAA;AACD,EAVM;AA4BA,MAAMG,mBAAmB,GAAG,CAAC;EAClCC,MADkC;EAElCC,QAFkC;EAGlCV,OAHkC;AAIlCC,EAAAA,cAAc,GAAG,KAAA;AAJiB,CAAD,KAKU;EAC3CN,KAAK,CAACgB,SAAN,CAAgB,MAAM;AACpBF,IAAAA,MAAM,CAACG,KAAP,EAAA,CAAA;AACA,IAAA,OAAO,MAAM;AACXH,MAAAA,MAAM,CAACI,OAAP,EAAA,CAAA;KADF,CAAA;GAFF,EAKG,CAACJ,MAAD,CALH,CAAA,CAAA;;EAOA,IAAIK,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAAzB,IAAyCf,cAA7C,EAA6D;IAC3DQ,MAAM,CACHQ,SADH,EAAA,CAEGC,KAFH,CAAA,6FAAA,CAAA,CAAA;AAKD,GAAA;;AAED,EAAA,MAAMC,OAAO,GAAGpB,qBAAqB,CAACC,OAAD,EAAUC,cAAV,CAArC,CAAA;EAEA,oBACE,KAAA,CAAA,aAAA,CAAC,yBAAD,CAA2B,QAA3B,EAAA;IAAoC,KAAK,EAAE,CAACD,OAAD,IAAYC,cAAAA;GACrD,eAAA,KAAA,CAAA,aAAA,CAAC,OAAD,CAAS,QAAT,EAAA;AAAkB,IAAA,KAAK,EAAEQ,MAAAA;GAASC,EAAAA,QAAlC,CADF,CADF,CAAA;AAKD;;;;"}
1
+ {"version":3,"file":"QueryClientProvider.esm.js","sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport type { QueryClient } from '@tanstack/query-core'\nimport type { ContextOptions } from './types'\n\ndeclare global {\n interface Window {\n ReactQueryClientContext?: React.Context<QueryClient | undefined>\n }\n}\n\nexport const defaultContext = React.createContext<QueryClient | undefined>(\n undefined,\n)\nconst QueryClientSharingContext = React.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 React 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: React.Context<QueryClient | undefined> | undefined,\n contextSharing: boolean,\n) {\n if (context) {\n return context\n }\n if (contextSharing && typeof window !== 'undefined') {\n if (!window.ReactQueryClientContext) {\n window.ReactQueryClientContext = defaultContext\n }\n\n return window.ReactQueryClientContext\n }\n\n return defaultContext\n}\n\nexport const useQueryClient = ({ context }: ContextOptions = {}) => {\n const queryClient = React.useContext(\n getQueryClientContext(context, React.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?: React.ReactNode\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 client,\n children,\n context,\n contextSharing = false,\n}: QueryClientProviderProps): JSX.Element => {\n React.useEffect(() => {\n client.mount()\n return () => {\n client.unmount()\n }\n }, [client])\n\n if (process.env.NODE_ENV !== 'production' && contextSharing) {\n 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 const Context = getQueryClientContext(context, contextSharing)\n\n return (\n <QueryClientSharingContext.Provider value={!context && contextSharing}>\n <Context.Provider value={client}>{children}</Context.Provider>\n </QueryClientSharingContext.Provider>\n )\n}\n"],"names":["defaultContext","React","createContext","undefined","QueryClientSharingContext","getQueryClientContext","context","contextSharing","window","ReactQueryClientContext","useQueryClient","queryClient","useContext","Error","QueryClientProvider","client","children","useEffect","mount","unmount","process","env","NODE_ENV","getLogger","error","Context"],"mappings":";;AAYO,MAAMA,cAAc,gBAAGC,KAAK,CAACC,aAAN,CAC5BC,SAD4B,EAAvB;AAGP,MAAMC,yBAAyB,gBAAGH,KAAK,CAACC,aAAN,CAA6B,KAA7B,CAAlC;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,GAAiCT,cAAjC,CAAA;AACD,KAAA;;IAED,OAAOQ,MAAM,CAACC,uBAAd,CAAA;AACD,GAAA;;AAED,EAAA,OAAOT,cAAP,CAAA;AACD,CAAA;;AAEM,MAAMU,cAAc,GAAG,CAAC;AAAEJ,EAAAA,OAAAA;AAAF,CAAA,GAA8B,EAA/B,KAAsC;AAClE,EAAA,MAAMK,WAAW,GAAGV,KAAK,CAACW,UAAN,CAClBP,qBAAqB,CAACC,OAAD,EAAUL,KAAK,CAACW,UAAN,CAAiBR,yBAAjB,CAAV,CADH,CAApB,CAAA;;EAIA,IAAI,CAACO,WAAL,EAAkB;AAChB,IAAA,MAAM,IAAIE,KAAJ,CAAU,wDAAV,CAAN,CAAA;AACD,GAAA;;AAED,EAAA,OAAOF,WAAP,CAAA;AACD,EAVM;AA4BA,MAAMG,mBAAmB,GAAG,CAAC;EAClCC,MADkC;EAElCC,QAFkC;EAGlCV,OAHkC;AAIlCC,EAAAA,cAAc,GAAG,KAAA;AAJiB,CAAD,KAKU;EAC3CN,KAAK,CAACgB,SAAN,CAAgB,MAAM;AACpBF,IAAAA,MAAM,CAACG,KAAP,EAAA,CAAA;AACA,IAAA,OAAO,MAAM;AACXH,MAAAA,MAAM,CAACI,OAAP,EAAA,CAAA;KADF,CAAA;GAFF,EAKG,CAACJ,MAAD,CALH,CAAA,CAAA;;EAOA,IAAIK,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAAzB,IAAyCf,cAA7C,EAA6D;IAC3DQ,MAAM,CACHQ,SADH,EAAA,CAEGC,KAFH,CAAA,6FAAA,CAAA,CAAA;AAKD,GAAA;;AAED,EAAA,MAAMC,OAAO,GAAGpB,qBAAqB,CAACC,OAAD,EAAUC,cAAV,CAArC,CAAA;EAEA,oBACE,KAAA,CAAA,aAAA,CAAC,yBAAD,CAA2B,QAA3B,EAAA;IAAoC,KAAK,EAAE,CAACD,OAAD,IAAYC,cAAAA;GACrD,eAAA,KAAA,CAAA,aAAA,CAAC,OAAD,CAAS,QAAT,EAAA;AAAkB,IAAA,KAAK,EAAEQ,MAAAA;GAASC,EAAAA,QAAlC,CADF,CADF,CAAA;AAKD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"QueryClientProvider.js","sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport type { QueryClient } from '@tanstack/query-core'\nimport type { ContextOptions } from './types'\n\ndeclare global {\n interface Window {\n ReactQueryClientContext?: React.Context<QueryClient | undefined>\n }\n}\n\nexport const defaultContext = React.createContext<QueryClient | undefined>(\n undefined,\n)\nconst QueryClientSharingContext = React.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 React 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: React.Context<QueryClient | undefined> | undefined,\n contextSharing: boolean,\n) {\n if (context) {\n return context\n }\n if (contextSharing && typeof window !== 'undefined') {\n if (!window.ReactQueryClientContext) {\n window.ReactQueryClientContext = defaultContext\n }\n\n return window.ReactQueryClientContext\n }\n\n return defaultContext\n}\n\nexport const useQueryClient = ({ context }: ContextOptions = {}) => {\n const queryClient = React.useContext(\n getQueryClientContext(context, React.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?: React.ReactNode\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 client,\n children,\n context,\n contextSharing = false,\n}: QueryClientProviderProps): JSX.Element => {\n React.useEffect(() => {\n client.mount()\n return () => {\n client.unmount()\n }\n }, [client])\n\n if (process.env.NODE_ENV !== 'production' && contextSharing) {\n 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 const Context = getQueryClientContext(context, contextSharing)\n\n return (\n <QueryClientSharingContext.Provider value={!context && contextSharing}>\n <Context.Provider value={client}>{children}</Context.Provider>\n </QueryClientSharingContext.Provider>\n )\n}\n"],"names":["defaultContext","React","createContext","undefined","QueryClientSharingContext","getQueryClientContext","context","contextSharing","window","ReactQueryClientContext","useQueryClient","queryClient","useContext","Error","QueryClientProvider","client","children","useEffect","mount","unmount","process","env","NODE_ENV","getLogger","error","Context"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAWO,MAAMA,cAAc,gBAAGC,gBAAK,CAACC,aAAN,CAC5BC,SAD4B,EAAvB;AAGP,MAAMC,yBAAyB,gBAAGH,gBAAK,CAACC,aAAN,CAA6B,KAA7B,CAAlC;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,GAAiCT,cAAjC,CAAA;AACD,KAAA;;IAED,OAAOQ,MAAM,CAACC,uBAAd,CAAA;AACD,GAAA;;AAED,EAAA,OAAOT,cAAP,CAAA;AACD,CAAA;;AAEM,MAAMU,cAAc,GAAG,CAAC;AAAEJ,EAAAA,OAAAA;AAAF,CAAA,GAA8B,EAA/B,KAAsC;AAClE,EAAA,MAAMK,WAAW,GAAGV,gBAAK,CAACW,UAAN,CAClBP,qBAAqB,CAACC,OAAD,EAAUL,gBAAK,CAACW,UAAN,CAAiBR,yBAAjB,CAAV,CADH,CAApB,CAAA;;EAIA,IAAI,CAACO,WAAL,EAAkB;AAChB,IAAA,MAAM,IAAIE,KAAJ,CAAU,wDAAV,CAAN,CAAA;AACD,GAAA;;AAED,EAAA,OAAOF,WAAP,CAAA;AACD,EAVM;AA4BA,MAAMG,mBAAmB,GAAG,CAAC;EAClCC,MADkC;EAElCC,QAFkC;EAGlCV,OAHkC;AAIlCC,EAAAA,cAAc,GAAG,KAAA;AAJiB,CAAD,KAKU;EAC3CN,gBAAK,CAACgB,SAAN,CAAgB,MAAM;AACpBF,IAAAA,MAAM,CAACG,KAAP,EAAA,CAAA;AACA,IAAA,OAAO,MAAM;AACXH,MAAAA,MAAM,CAACI,OAAP,EAAA,CAAA;KADF,CAAA;GAFF,EAKG,CAACJ,MAAD,CALH,CAAA,CAAA;;EAOA,IAAIK,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAAzB,IAAyCf,cAA7C,EAA6D;IAC3DQ,MAAM,CACHQ,SADH,EAAA,CAEGC,KAFH,CAAA,6FAAA,CAAA,CAAA;AAKD,GAAA;;AAED,EAAA,MAAMC,OAAO,GAAGpB,qBAAqB,CAACC,OAAD,EAAUC,cAAV,CAArC,CAAA;EAEA,oBACEN,gBAAA,CAAA,aAAA,CAAC,yBAAD,CAA2B,QAA3B,EAAA;IAAoC,KAAK,EAAE,CAACK,OAAD,IAAYC,cAAAA;GACrD,eAAAN,gBAAA,CAAA,aAAA,CAAC,OAAD,CAAS,QAAT,EAAA;AAAkB,IAAA,KAAK,EAAEc,MAAAA;GAASC,EAAAA,QAAlC,CADF,CADF,CAAA;AAKD;;;;;;"}
1
+ {"version":3,"file":"QueryClientProvider.js","sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport type { QueryClient } from '@tanstack/query-core'\nimport type { ContextOptions } from './types'\n\ndeclare global {\n interface Window {\n ReactQueryClientContext?: React.Context<QueryClient | undefined>\n }\n}\n\nexport const defaultContext = React.createContext<QueryClient | undefined>(\n undefined,\n)\nconst QueryClientSharingContext = React.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 React 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: React.Context<QueryClient | undefined> | undefined,\n contextSharing: boolean,\n) {\n if (context) {\n return context\n }\n if (contextSharing && typeof window !== 'undefined') {\n if (!window.ReactQueryClientContext) {\n window.ReactQueryClientContext = defaultContext\n }\n\n return window.ReactQueryClientContext\n }\n\n return defaultContext\n}\n\nexport const useQueryClient = ({ context }: ContextOptions = {}) => {\n const queryClient = React.useContext(\n getQueryClientContext(context, React.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?: React.ReactNode\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 client,\n children,\n context,\n contextSharing = false,\n}: QueryClientProviderProps): JSX.Element => {\n React.useEffect(() => {\n client.mount()\n return () => {\n client.unmount()\n }\n }, [client])\n\n if (process.env.NODE_ENV !== 'production' && contextSharing) {\n 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 const Context = getQueryClientContext(context, contextSharing)\n\n return (\n <QueryClientSharingContext.Provider value={!context && contextSharing}>\n <Context.Provider value={client}>{children}</Context.Provider>\n </QueryClientSharingContext.Provider>\n )\n}\n"],"names":["defaultContext","React","createContext","undefined","QueryClientSharingContext","getQueryClientContext","context","contextSharing","window","ReactQueryClientContext","useQueryClient","queryClient","useContext","Error","QueryClientProvider","client","children","useEffect","mount","unmount","process","env","NODE_ENV","getLogger","error","Context"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAYO,MAAMA,cAAc,gBAAGC,gBAAK,CAACC,aAAN,CAC5BC,SAD4B,EAAvB;AAGP,MAAMC,yBAAyB,gBAAGH,gBAAK,CAACC,aAAN,CAA6B,KAA7B,CAAlC;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,GAAiCT,cAAjC,CAAA;AACD,KAAA;;IAED,OAAOQ,MAAM,CAACC,uBAAd,CAAA;AACD,GAAA;;AAED,EAAA,OAAOT,cAAP,CAAA;AACD,CAAA;;AAEM,MAAMU,cAAc,GAAG,CAAC;AAAEJ,EAAAA,OAAAA;AAAF,CAAA,GAA8B,EAA/B,KAAsC;AAClE,EAAA,MAAMK,WAAW,GAAGV,gBAAK,CAACW,UAAN,CAClBP,qBAAqB,CAACC,OAAD,EAAUL,gBAAK,CAACW,UAAN,CAAiBR,yBAAjB,CAAV,CADH,CAApB,CAAA;;EAIA,IAAI,CAACO,WAAL,EAAkB;AAChB,IAAA,MAAM,IAAIE,KAAJ,CAAU,wDAAV,CAAN,CAAA;AACD,GAAA;;AAED,EAAA,OAAOF,WAAP,CAAA;AACD,EAVM;AA4BA,MAAMG,mBAAmB,GAAG,CAAC;EAClCC,MADkC;EAElCC,QAFkC;EAGlCV,OAHkC;AAIlCC,EAAAA,cAAc,GAAG,KAAA;AAJiB,CAAD,KAKU;EAC3CN,gBAAK,CAACgB,SAAN,CAAgB,MAAM;AACpBF,IAAAA,MAAM,CAACG,KAAP,EAAA,CAAA;AACA,IAAA,OAAO,MAAM;AACXH,MAAAA,MAAM,CAACI,OAAP,EAAA,CAAA;KADF,CAAA;GAFF,EAKG,CAACJ,MAAD,CALH,CAAA,CAAA;;EAOA,IAAIK,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAAzB,IAAyCf,cAA7C,EAA6D;IAC3DQ,MAAM,CACHQ,SADH,EAAA,CAEGC,KAFH,CAAA,6FAAA,CAAA,CAAA;AAKD,GAAA;;AAED,EAAA,MAAMC,OAAO,GAAGpB,qBAAqB,CAACC,OAAD,EAAUC,cAAV,CAArC,CAAA;EAEA,oBACEN,gBAAA,CAAA,aAAA,CAAC,yBAAD,CAA2B,QAA3B,EAAA;IAAoC,KAAK,EAAE,CAACK,OAAD,IAAYC,cAAAA;GACrD,eAAAN,gBAAA,CAAA,aAAA,CAAC,OAAD,CAAS,QAAT,EAAA;AAAkB,IAAA,KAAK,EAAEc,MAAAA;GAASC,EAAAA,QAAlC,CADF,CADF,CAAA;AAKD;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"QueryClientProvider.mjs","sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport type { QueryClient } from '@tanstack/query-core'\nimport type { ContextOptions } from './types'\n\ndeclare global {\n interface Window {\n ReactQueryClientContext?: React.Context<QueryClient | undefined>\n }\n}\n\nexport const defaultContext = React.createContext<QueryClient | undefined>(\n undefined,\n)\nconst QueryClientSharingContext = React.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 React 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: React.Context<QueryClient | undefined> | undefined,\n contextSharing: boolean,\n) {\n if (context) {\n return context\n }\n if (contextSharing && typeof window !== 'undefined') {\n if (!window.ReactQueryClientContext) {\n window.ReactQueryClientContext = defaultContext\n }\n\n return window.ReactQueryClientContext\n }\n\n return defaultContext\n}\n\nexport const useQueryClient = ({ context }: ContextOptions = {}) => {\n const queryClient = React.useContext(\n getQueryClientContext(context, React.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?: React.ReactNode\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 client,\n children,\n context,\n contextSharing = false,\n}: QueryClientProviderProps): JSX.Element => {\n React.useEffect(() => {\n client.mount()\n return () => {\n client.unmount()\n }\n }, [client])\n\n if (process.env.NODE_ENV !== 'production' && contextSharing) {\n 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 const Context = getQueryClientContext(context, contextSharing)\n\n return (\n <QueryClientSharingContext.Provider value={!context && contextSharing}>\n <Context.Provider value={client}>{children}</Context.Provider>\n </QueryClientSharingContext.Provider>\n )\n}\n"],"names":["defaultContext","React","createContext","undefined","QueryClientSharingContext","getQueryClientContext","context","contextSharing","window","ReactQueryClientContext","useQueryClient","queryClient","useContext","Error","QueryClientProvider","client","children","useEffect","mount","unmount","process","env","NODE_ENV","getLogger","error","Context"],"mappings":";;AAWO,MAAMA,cAAc,gBAAGC,KAAK,CAACC,aAAN,CAC5BC,SAD4B,EAAvB;AAGP,MAAMC,yBAAyB,gBAAGH,KAAK,CAACC,aAAN,CAA6B,KAA7B,CAAlC;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,GAAiCT,cAAjC,CAAA;AACD,KAAA;;IAED,OAAOQ,MAAM,CAACC,uBAAd,CAAA;AACD,GAAA;;AAED,EAAA,OAAOT,cAAP,CAAA;AACD,CAAA;;AAEM,MAAMU,cAAc,GAAG,CAAC;AAAEJ,EAAAA,OAAAA;AAAF,CAAA,GAA8B,EAA/B,KAAsC;AAClE,EAAA,MAAMK,WAAW,GAAGV,KAAK,CAACW,UAAN,CAClBP,qBAAqB,CAACC,OAAD,EAAUL,KAAK,CAACW,UAAN,CAAiBR,yBAAjB,CAAV,CADH,CAApB,CAAA;;EAIA,IAAI,CAACO,WAAL,EAAkB;AAChB,IAAA,MAAM,IAAIE,KAAJ,CAAU,wDAAV,CAAN,CAAA;AACD,GAAA;;AAED,EAAA,OAAOF,WAAP,CAAA;AACD,EAVM;AA4BA,MAAMG,mBAAmB,GAAG,CAAC;EAClCC,MADkC;EAElCC,QAFkC;EAGlCV,OAHkC;AAIlCC,EAAAA,cAAc,GAAG,KAAA;AAJiB,CAAD,KAKU;EAC3CN,KAAK,CAACgB,SAAN,CAAgB,MAAM;AACpBF,IAAAA,MAAM,CAACG,KAAP,EAAA,CAAA;AACA,IAAA,OAAO,MAAM;AACXH,MAAAA,MAAM,CAACI,OAAP,EAAA,CAAA;KADF,CAAA;GAFF,EAKG,CAACJ,MAAD,CALH,CAAA,CAAA;;EAOA,IAAIK,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAAzB,IAAyCf,cAA7C,EAA6D;IAC3DQ,MAAM,CACHQ,SADH,EAAA,CAEGC,KAFH,CAAA,6FAAA,CAAA,CAAA;AAKD,GAAA;;AAED,EAAA,MAAMC,OAAO,GAAGpB,qBAAqB,CAACC,OAAD,EAAUC,cAAV,CAArC,CAAA;EAEA,oBACE,KAAA,CAAA,aAAA,CAAC,yBAAD,CAA2B,QAA3B,EAAA;IAAoC,KAAK,EAAE,CAACD,OAAD,IAAYC,cAAAA;GACrD,eAAA,KAAA,CAAA,aAAA,CAAC,OAAD,CAAS,QAAT,EAAA;AAAkB,IAAA,KAAK,EAAEQ,MAAAA;GAASC,EAAAA,QAAlC,CADF,CADF,CAAA;AAKD;;;;"}
1
+ {"version":3,"file":"QueryClientProvider.mjs","sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport type { QueryClient } from '@tanstack/query-core'\nimport type { ContextOptions } from './types'\n\ndeclare global {\n interface Window {\n ReactQueryClientContext?: React.Context<QueryClient | undefined>\n }\n}\n\nexport const defaultContext = React.createContext<QueryClient | undefined>(\n undefined,\n)\nconst QueryClientSharingContext = React.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 React 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: React.Context<QueryClient | undefined> | undefined,\n contextSharing: boolean,\n) {\n if (context) {\n return context\n }\n if (contextSharing && typeof window !== 'undefined') {\n if (!window.ReactQueryClientContext) {\n window.ReactQueryClientContext = defaultContext\n }\n\n return window.ReactQueryClientContext\n }\n\n return defaultContext\n}\n\nexport const useQueryClient = ({ context }: ContextOptions = {}) => {\n const queryClient = React.useContext(\n getQueryClientContext(context, React.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?: React.ReactNode\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 client,\n children,\n context,\n contextSharing = false,\n}: QueryClientProviderProps): JSX.Element => {\n React.useEffect(() => {\n client.mount()\n return () => {\n client.unmount()\n }\n }, [client])\n\n if (process.env.NODE_ENV !== 'production' && contextSharing) {\n 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 const Context = getQueryClientContext(context, contextSharing)\n\n return (\n <QueryClientSharingContext.Provider value={!context && contextSharing}>\n <Context.Provider value={client}>{children}</Context.Provider>\n </QueryClientSharingContext.Provider>\n )\n}\n"],"names":["defaultContext","React","createContext","undefined","QueryClientSharingContext","getQueryClientContext","context","contextSharing","window","ReactQueryClientContext","useQueryClient","queryClient","useContext","Error","QueryClientProvider","client","children","useEffect","mount","unmount","process","env","NODE_ENV","getLogger","error","Context"],"mappings":";;AAYO,MAAMA,cAAc,gBAAGC,KAAK,CAACC,aAAN,CAC5BC,SAD4B,EAAvB;AAGP,MAAMC,yBAAyB,gBAAGH,KAAK,CAACC,aAAN,CAA6B,KAA7B,CAAlC;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,GAAiCT,cAAjC,CAAA;AACD,KAAA;;IAED,OAAOQ,MAAM,CAACC,uBAAd,CAAA;AACD,GAAA;;AAED,EAAA,OAAOT,cAAP,CAAA;AACD,CAAA;;AAEM,MAAMU,cAAc,GAAG,CAAC;AAAEJ,EAAAA,OAAAA;AAAF,CAAA,GAA8B,EAA/B,KAAsC;AAClE,EAAA,MAAMK,WAAW,GAAGV,KAAK,CAACW,UAAN,CAClBP,qBAAqB,CAACC,OAAD,EAAUL,KAAK,CAACW,UAAN,CAAiBR,yBAAjB,CAAV,CADH,CAApB,CAAA;;EAIA,IAAI,CAACO,WAAL,EAAkB;AAChB,IAAA,MAAM,IAAIE,KAAJ,CAAU,wDAAV,CAAN,CAAA;AACD,GAAA;;AAED,EAAA,OAAOF,WAAP,CAAA;AACD,EAVM;AA4BA,MAAMG,mBAAmB,GAAG,CAAC;EAClCC,MADkC;EAElCC,QAFkC;EAGlCV,OAHkC;AAIlCC,EAAAA,cAAc,GAAG,KAAA;AAJiB,CAAD,KAKU;EAC3CN,KAAK,CAACgB,SAAN,CAAgB,MAAM;AACpBF,IAAAA,MAAM,CAACG,KAAP,EAAA,CAAA;AACA,IAAA,OAAO,MAAM;AACXH,MAAAA,MAAM,CAACI,OAAP,EAAA,CAAA;KADF,CAAA;GAFF,EAKG,CAACJ,MAAD,CALH,CAAA,CAAA;;EAOA,IAAIK,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAAzB,IAAyCf,cAA7C,EAA6D;IAC3DQ,MAAM,CACHQ,SADH,EAAA,CAEGC,KAFH,CAAA,6FAAA,CAAA,CAAA;AAKD,GAAA;;AAED,EAAA,MAAMC,OAAO,GAAGpB,qBAAqB,CAACC,OAAD,EAAUC,cAAV,CAArC,CAAA;EAEA,oBACE,KAAA,CAAA,aAAA,CAAC,yBAAD,CAA2B,QAA3B,EAAA;IAAoC,KAAK,EAAE,CAACD,OAAD,IAAYC,cAAAA;GACrD,eAAA,KAAA,CAAA,aAAA,CAAC,OAAD,CAAS,QAAT,EAAA;AAAkB,IAAA,KAAK,EAAEQ,MAAAA;GAASC,EAAAA,QAAlC,CADF,CADF,CAAA;AAKD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"QueryErrorResetBoundary.esm.js","sources":["../../src/QueryErrorResetBoundary.tsx"],"sourcesContent":["import * as React from 'react'\n\n// CONTEXT\n\nexport interface QueryErrorResetBoundaryValue {\n clearReset: () => void\n isReset: () => boolean\n reset: () => void\n}\n\nfunction createValue(): QueryErrorResetBoundaryValue {\n let isReset = false\n return {\n clearReset: () => {\n isReset = false\n },\n reset: () => {\n isReset = true\n },\n isReset: () => {\n return isReset\n },\n }\n}\n\nconst QueryErrorResetBoundaryContext = React.createContext(createValue())\n\n// HOOK\n\nexport const useQueryErrorResetBoundary = () =>\n React.useContext(QueryErrorResetBoundaryContext)\n\n// COMPONENT\n\nexport interface QueryErrorResetBoundaryProps {\n children:\n | ((value: QueryErrorResetBoundaryValue) => React.ReactNode)\n | React.ReactNode\n}\n\nexport const QueryErrorResetBoundary = ({\n children,\n}: QueryErrorResetBoundaryProps) => {\n const [value] = React.useState(() => createValue())\n return (\n <QueryErrorResetBoundaryContext.Provider value={value}>\n {typeof children === 'function'\n ? (children as Function)(value)\n : children}\n </QueryErrorResetBoundaryContext.Provider>\n )\n}\n"],"names":["createValue","isReset","clearReset","reset","QueryErrorResetBoundaryContext","React","createContext","useQueryErrorResetBoundary","useContext","QueryErrorResetBoundary","children","value","useState"],"mappings":";;AAUA,SAASA,WAAT,GAAqD;EACnD,IAAIC,OAAO,GAAG,KAAd,CAAA;EACA,OAAO;AACLC,IAAAA,UAAU,EAAE,MAAM;AAChBD,MAAAA,OAAO,GAAG,KAAV,CAAA;KAFG;AAILE,IAAAA,KAAK,EAAE,MAAM;AACXF,MAAAA,OAAO,GAAG,IAAV,CAAA;KALG;AAOLA,IAAAA,OAAO,EAAE,MAAM;AACb,MAAA,OAAOA,OAAP,CAAA;AACD,KAAA;GATH,CAAA;AAWD,CAAA;;AAED,MAAMG,8BAA8B,gBAAGC,KAAK,CAACC,aAAN,CAAoBN,WAAW,EAA/B,CAAvC;;AAIO,MAAMO,0BAA0B,GAAG,MACxCF,KAAK,CAACG,UAAN,CAAiBJ,8BAAjB;;AAUK,MAAMK,uBAAuB,GAAG,CAAC;AACtCC,EAAAA,QAAAA;AADsC,CAAD,KAEH;EAClC,MAAM,CAACC,KAAD,CAAA,GAAUN,KAAK,CAACO,QAAN,CAAe,MAAMZ,WAAW,EAAhC,CAAhB,CAAA;EACA,oBACE,KAAA,CAAA,aAAA,CAAC,8BAAD,CAAgC,QAAhC,EAAA;AAAyC,IAAA,KAAK,EAAEW,KAAAA;GAC7C,EAAA,OAAOD,QAAP,KAAoB,UAApB,GACIA,QAAD,CAAuBC,KAAvB,CADH,GAEGD,QAHN,CADF,CAAA;AAOD;;;;"}
1
+ {"version":3,"file":"QueryErrorResetBoundary.esm.js","sources":["../../src/QueryErrorResetBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\n// CONTEXT\n\nexport interface QueryErrorResetBoundaryValue {\n clearReset: () => void\n isReset: () => boolean\n reset: () => void\n}\n\nfunction createValue(): QueryErrorResetBoundaryValue {\n let isReset = false\n return {\n clearReset: () => {\n isReset = false\n },\n reset: () => {\n isReset = true\n },\n isReset: () => {\n return isReset\n },\n }\n}\n\nconst QueryErrorResetBoundaryContext = React.createContext(createValue())\n\n// HOOK\n\nexport const useQueryErrorResetBoundary = () =>\n React.useContext(QueryErrorResetBoundaryContext)\n\n// COMPONENT\n\nexport interface QueryErrorResetBoundaryProps {\n children:\n | ((value: QueryErrorResetBoundaryValue) => React.ReactNode)\n | React.ReactNode\n}\n\nexport const QueryErrorResetBoundary = ({\n children,\n}: QueryErrorResetBoundaryProps) => {\n const [value] = React.useState(() => createValue())\n return (\n <QueryErrorResetBoundaryContext.Provider value={value}>\n {typeof children === 'function'\n ? (children as Function)(value)\n : children}\n </QueryErrorResetBoundaryContext.Provider>\n )\n}\n"],"names":["createValue","isReset","clearReset","reset","QueryErrorResetBoundaryContext","React","createContext","useQueryErrorResetBoundary","useContext","QueryErrorResetBoundary","children","value","useState"],"mappings":";;AAWA,SAASA,WAAT,GAAqD;EACnD,IAAIC,OAAO,GAAG,KAAd,CAAA;EACA,OAAO;AACLC,IAAAA,UAAU,EAAE,MAAM;AAChBD,MAAAA,OAAO,GAAG,KAAV,CAAA;KAFG;AAILE,IAAAA,KAAK,EAAE,MAAM;AACXF,MAAAA,OAAO,GAAG,IAAV,CAAA;KALG;AAOLA,IAAAA,OAAO,EAAE,MAAM;AACb,MAAA,OAAOA,OAAP,CAAA;AACD,KAAA;GATH,CAAA;AAWD,CAAA;;AAED,MAAMG,8BAA8B,gBAAGC,KAAK,CAACC,aAAN,CAAoBN,WAAW,EAA/B,CAAvC;;AAIO,MAAMO,0BAA0B,GAAG,MACxCF,KAAK,CAACG,UAAN,CAAiBJ,8BAAjB;;AAUK,MAAMK,uBAAuB,GAAG,CAAC;AACtCC,EAAAA,QAAAA;AADsC,CAAD,KAEH;EAClC,MAAM,CAACC,KAAD,CAAA,GAAUN,KAAK,CAACO,QAAN,CAAe,MAAMZ,WAAW,EAAhC,CAAhB,CAAA;EACA,oBACE,KAAA,CAAA,aAAA,CAAC,8BAAD,CAAgC,QAAhC,EAAA;AAAyC,IAAA,KAAK,EAAEW,KAAAA;GAC7C,EAAA,OAAOD,QAAP,KAAoB,UAApB,GACIA,QAAD,CAAuBC,KAAvB,CADH,GAEGD,QAHN,CADF,CAAA;AAOD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"QueryErrorResetBoundary.js","sources":["../../src/QueryErrorResetBoundary.tsx"],"sourcesContent":["import * as React from 'react'\n\n// CONTEXT\n\nexport interface QueryErrorResetBoundaryValue {\n clearReset: () => void\n isReset: () => boolean\n reset: () => void\n}\n\nfunction createValue(): QueryErrorResetBoundaryValue {\n let isReset = false\n return {\n clearReset: () => {\n isReset = false\n },\n reset: () => {\n isReset = true\n },\n isReset: () => {\n return isReset\n },\n }\n}\n\nconst QueryErrorResetBoundaryContext = React.createContext(createValue())\n\n// HOOK\n\nexport const useQueryErrorResetBoundary = () =>\n React.useContext(QueryErrorResetBoundaryContext)\n\n// COMPONENT\n\nexport interface QueryErrorResetBoundaryProps {\n children:\n | ((value: QueryErrorResetBoundaryValue) => React.ReactNode)\n | React.ReactNode\n}\n\nexport const QueryErrorResetBoundary = ({\n children,\n}: QueryErrorResetBoundaryProps) => {\n const [value] = React.useState(() => createValue())\n return (\n <QueryErrorResetBoundaryContext.Provider value={value}>\n {typeof children === 'function'\n ? (children as Function)(value)\n : children}\n </QueryErrorResetBoundaryContext.Provider>\n )\n}\n"],"names":["createValue","isReset","clearReset","reset","QueryErrorResetBoundaryContext","React","createContext","useQueryErrorResetBoundary","useContext","QueryErrorResetBoundary","children","value","useState"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,SAASA,WAAT,GAAqD;EACnD,IAAIC,OAAO,GAAG,KAAd,CAAA;EACA,OAAO;AACLC,IAAAA,UAAU,EAAE,MAAM;AAChBD,MAAAA,OAAO,GAAG,KAAV,CAAA;KAFG;AAILE,IAAAA,KAAK,EAAE,MAAM;AACXF,MAAAA,OAAO,GAAG,IAAV,CAAA;KALG;AAOLA,IAAAA,OAAO,EAAE,MAAM;AACb,MAAA,OAAOA,OAAP,CAAA;AACD,KAAA;GATH,CAAA;AAWD,CAAA;;AAED,MAAMG,8BAA8B,gBAAGC,gBAAK,CAACC,aAAN,CAAoBN,WAAW,EAA/B,CAAvC;;AAIO,MAAMO,0BAA0B,GAAG,MACxCF,gBAAK,CAACG,UAAN,CAAiBJ,8BAAjB;;AAUK,MAAMK,uBAAuB,GAAG,CAAC;AACtCC,EAAAA,QAAAA;AADsC,CAAD,KAEH;EAClC,MAAM,CAACC,KAAD,CAAA,GAAUN,gBAAK,CAACO,QAAN,CAAe,MAAMZ,WAAW,EAAhC,CAAhB,CAAA;EACA,oBACEK,gBAAA,CAAA,aAAA,CAAC,8BAAD,CAAgC,QAAhC,EAAA;AAAyC,IAAA,KAAK,EAAEM,KAAAA;GAC7C,EAAA,OAAOD,QAAP,KAAoB,UAApB,GACIA,QAAD,CAAuBC,KAAvB,CADH,GAEGD,QAHN,CADF,CAAA;AAOD;;;;;"}
1
+ {"version":3,"file":"QueryErrorResetBoundary.js","sources":["../../src/QueryErrorResetBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\n// CONTEXT\n\nexport interface QueryErrorResetBoundaryValue {\n clearReset: () => void\n isReset: () => boolean\n reset: () => void\n}\n\nfunction createValue(): QueryErrorResetBoundaryValue {\n let isReset = false\n return {\n clearReset: () => {\n isReset = false\n },\n reset: () => {\n isReset = true\n },\n isReset: () => {\n return isReset\n },\n }\n}\n\nconst QueryErrorResetBoundaryContext = React.createContext(createValue())\n\n// HOOK\n\nexport const useQueryErrorResetBoundary = () =>\n React.useContext(QueryErrorResetBoundaryContext)\n\n// COMPONENT\n\nexport interface QueryErrorResetBoundaryProps {\n children:\n | ((value: QueryErrorResetBoundaryValue) => React.ReactNode)\n | React.ReactNode\n}\n\nexport const QueryErrorResetBoundary = ({\n children,\n}: QueryErrorResetBoundaryProps) => {\n const [value] = React.useState(() => createValue())\n return (\n <QueryErrorResetBoundaryContext.Provider value={value}>\n {typeof children === 'function'\n ? (children as Function)(value)\n : children}\n </QueryErrorResetBoundaryContext.Provider>\n )\n}\n"],"names":["createValue","isReset","clearReset","reset","QueryErrorResetBoundaryContext","React","createContext","useQueryErrorResetBoundary","useContext","QueryErrorResetBoundary","children","value","useState"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,SAASA,WAAT,GAAqD;EACnD,IAAIC,OAAO,GAAG,KAAd,CAAA;EACA,OAAO;AACLC,IAAAA,UAAU,EAAE,MAAM;AAChBD,MAAAA,OAAO,GAAG,KAAV,CAAA;KAFG;AAILE,IAAAA,KAAK,EAAE,MAAM;AACXF,MAAAA,OAAO,GAAG,IAAV,CAAA;KALG;AAOLA,IAAAA,OAAO,EAAE,MAAM;AACb,MAAA,OAAOA,OAAP,CAAA;AACD,KAAA;GATH,CAAA;AAWD,CAAA;;AAED,MAAMG,8BAA8B,gBAAGC,gBAAK,CAACC,aAAN,CAAoBN,WAAW,EAA/B,CAAvC;;AAIO,MAAMO,0BAA0B,GAAG,MACxCF,gBAAK,CAACG,UAAN,CAAiBJ,8BAAjB;;AAUK,MAAMK,uBAAuB,GAAG,CAAC;AACtCC,EAAAA,QAAAA;AADsC,CAAD,KAEH;EAClC,MAAM,CAACC,KAAD,CAAA,GAAUN,gBAAK,CAACO,QAAN,CAAe,MAAMZ,WAAW,EAAhC,CAAhB,CAAA;EACA,oBACEK,gBAAA,CAAA,aAAA,CAAC,8BAAD,CAAgC,QAAhC,EAAA;AAAyC,IAAA,KAAK,EAAEM,KAAAA;GAC7C,EAAA,OAAOD,QAAP,KAAoB,UAApB,GACIA,QAAD,CAAuBC,KAAvB,CADH,GAEGD,QAHN,CADF,CAAA;AAOD;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"QueryErrorResetBoundary.mjs","sources":["../../src/QueryErrorResetBoundary.tsx"],"sourcesContent":["import * as React from 'react'\n\n// CONTEXT\n\nexport interface QueryErrorResetBoundaryValue {\n clearReset: () => void\n isReset: () => boolean\n reset: () => void\n}\n\nfunction createValue(): QueryErrorResetBoundaryValue {\n let isReset = false\n return {\n clearReset: () => {\n isReset = false\n },\n reset: () => {\n isReset = true\n },\n isReset: () => {\n return isReset\n },\n }\n}\n\nconst QueryErrorResetBoundaryContext = React.createContext(createValue())\n\n// HOOK\n\nexport const useQueryErrorResetBoundary = () =>\n React.useContext(QueryErrorResetBoundaryContext)\n\n// COMPONENT\n\nexport interface QueryErrorResetBoundaryProps {\n children:\n | ((value: QueryErrorResetBoundaryValue) => React.ReactNode)\n | React.ReactNode\n}\n\nexport const QueryErrorResetBoundary = ({\n children,\n}: QueryErrorResetBoundaryProps) => {\n const [value] = React.useState(() => createValue())\n return (\n <QueryErrorResetBoundaryContext.Provider value={value}>\n {typeof children === 'function'\n ? (children as Function)(value)\n : children}\n </QueryErrorResetBoundaryContext.Provider>\n )\n}\n"],"names":["createValue","isReset","clearReset","reset","QueryErrorResetBoundaryContext","React","createContext","useQueryErrorResetBoundary","useContext","QueryErrorResetBoundary","children","value","useState"],"mappings":";;AAUA,SAASA,WAAT,GAAqD;EACnD,IAAIC,OAAO,GAAG,KAAd,CAAA;EACA,OAAO;AACLC,IAAAA,UAAU,EAAE,MAAM;AAChBD,MAAAA,OAAO,GAAG,KAAV,CAAA;KAFG;AAILE,IAAAA,KAAK,EAAE,MAAM;AACXF,MAAAA,OAAO,GAAG,IAAV,CAAA;KALG;AAOLA,IAAAA,OAAO,EAAE,MAAM;AACb,MAAA,OAAOA,OAAP,CAAA;AACD,KAAA;GATH,CAAA;AAWD,CAAA;;AAED,MAAMG,8BAA8B,gBAAGC,KAAK,CAACC,aAAN,CAAoBN,WAAW,EAA/B,CAAvC;;AAIO,MAAMO,0BAA0B,GAAG,MACxCF,KAAK,CAACG,UAAN,CAAiBJ,8BAAjB;;AAUK,MAAMK,uBAAuB,GAAG,CAAC;AACtCC,EAAAA,QAAAA;AADsC,CAAD,KAEH;EAClC,MAAM,CAACC,KAAD,CAAA,GAAUN,KAAK,CAACO,QAAN,CAAe,MAAMZ,WAAW,EAAhC,CAAhB,CAAA;EACA,oBACE,KAAA,CAAA,aAAA,CAAC,8BAAD,CAAgC,QAAhC,EAAA;AAAyC,IAAA,KAAK,EAAEW,KAAAA;GAC7C,EAAA,OAAOD,QAAP,KAAoB,UAApB,GACIA,QAAD,CAAuBC,KAAvB,CADH,GAEGD,QAHN,CADF,CAAA;AAOD;;;;"}
1
+ {"version":3,"file":"QueryErrorResetBoundary.mjs","sources":["../../src/QueryErrorResetBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\n// CONTEXT\n\nexport interface QueryErrorResetBoundaryValue {\n clearReset: () => void\n isReset: () => boolean\n reset: () => void\n}\n\nfunction createValue(): QueryErrorResetBoundaryValue {\n let isReset = false\n return {\n clearReset: () => {\n isReset = false\n },\n reset: () => {\n isReset = true\n },\n isReset: () => {\n return isReset\n },\n }\n}\n\nconst QueryErrorResetBoundaryContext = React.createContext(createValue())\n\n// HOOK\n\nexport const useQueryErrorResetBoundary = () =>\n React.useContext(QueryErrorResetBoundaryContext)\n\n// COMPONENT\n\nexport interface QueryErrorResetBoundaryProps {\n children:\n | ((value: QueryErrorResetBoundaryValue) => React.ReactNode)\n | React.ReactNode\n}\n\nexport const QueryErrorResetBoundary = ({\n children,\n}: QueryErrorResetBoundaryProps) => {\n const [value] = React.useState(() => createValue())\n return (\n <QueryErrorResetBoundaryContext.Provider value={value}>\n {typeof children === 'function'\n ? (children as Function)(value)\n : children}\n </QueryErrorResetBoundaryContext.Provider>\n )\n}\n"],"names":["createValue","isReset","clearReset","reset","QueryErrorResetBoundaryContext","React","createContext","useQueryErrorResetBoundary","useContext","QueryErrorResetBoundary","children","value","useState"],"mappings":";;AAWA,SAASA,WAAT,GAAqD;EACnD,IAAIC,OAAO,GAAG,KAAd,CAAA;EACA,OAAO;AACLC,IAAAA,UAAU,EAAE,MAAM;AAChBD,MAAAA,OAAO,GAAG,KAAV,CAAA;KAFG;AAILE,IAAAA,KAAK,EAAE,MAAM;AACXF,MAAAA,OAAO,GAAG,IAAV,CAAA;KALG;AAOLA,IAAAA,OAAO,EAAE,MAAM;AACb,MAAA,OAAOA,OAAP,CAAA;AACD,KAAA;GATH,CAAA;AAWD,CAAA;;AAED,MAAMG,8BAA8B,gBAAGC,KAAK,CAACC,aAAN,CAAoBN,WAAW,EAA/B,CAAvC;;AAIO,MAAMO,0BAA0B,GAAG,MACxCF,KAAK,CAACG,UAAN,CAAiBJ,8BAAjB;;AAUK,MAAMK,uBAAuB,GAAG,CAAC;AACtCC,EAAAA,QAAAA;AADsC,CAAD,KAEH;EAClC,MAAM,CAACC,KAAD,CAAA,GAAUN,KAAK,CAACO,QAAN,CAAe,MAAMZ,WAAW,EAAhC,CAAhB,CAAA;EACA,oBACE,KAAA,CAAA,aAAA,CAAC,8BAAD,CAAgC,QAAhC,EAAA;AAAyC,IAAA,KAAK,EAAEW,KAAAA;GAC7C,EAAA,OAAOD,QAAP,KAAoB,UAApB,GACIA,QAAD,CAAuBC,KAAvB,CADH,GAEGD,QAHN,CADF,CAAA;AAOD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"isRestoring.esm.js","sources":["../../src/isRestoring.tsx"],"sourcesContent":["import * as React from 'react'\n\nconst IsRestoringContext = React.createContext(false)\n\nexport const useIsRestoring = () => React.useContext(IsRestoringContext)\nexport const IsRestoringProvider = IsRestoringContext.Provider\n"],"names":["IsRestoringContext","React","createContext","useIsRestoring","useContext","IsRestoringProvider","Provider"],"mappings":";;AAEA,MAAMA,kBAAkB,gBAAGC,KAAK,CAACC,aAAN,CAAoB,KAApB,CAA3B,CAAA;AAEO,MAAMC,cAAc,GAAG,MAAMF,KAAK,CAACG,UAAN,CAAiBJ,kBAAjB,EAA7B;AACMK,MAAAA,mBAAmB,GAAGL,kBAAkB,CAACM;;;;"}
1
+ {"version":3,"file":"isRestoring.esm.js","sources":["../../src/isRestoring.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nconst IsRestoringContext = React.createContext(false)\n\nexport const useIsRestoring = () => React.useContext(IsRestoringContext)\nexport const IsRestoringProvider = IsRestoringContext.Provider\n"],"names":["IsRestoringContext","React","createContext","useIsRestoring","useContext","IsRestoringProvider","Provider"],"mappings":";;AAGA,MAAMA,kBAAkB,gBAAGC,KAAK,CAACC,aAAN,CAAoB,KAApB,CAA3B,CAAA;AAEO,MAAMC,cAAc,GAAG,MAAMF,KAAK,CAACG,UAAN,CAAiBJ,kBAAjB,EAA7B;AACMK,MAAAA,mBAAmB,GAAGL,kBAAkB,CAACM;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"isRestoring.js","sources":["../../src/isRestoring.tsx"],"sourcesContent":["import * as React from 'react'\n\nconst IsRestoringContext = React.createContext(false)\n\nexport const useIsRestoring = () => React.useContext(IsRestoringContext)\nexport const IsRestoringProvider = IsRestoringContext.Provider\n"],"names":["IsRestoringContext","React","createContext","useIsRestoring","useContext","IsRestoringProvider","Provider"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAMA,kBAAkB,gBAAGC,gBAAK,CAACC,aAAN,CAAoB,KAApB,CAA3B,CAAA;AAEO,MAAMC,cAAc,GAAG,MAAMF,gBAAK,CAACG,UAAN,CAAiBJ,kBAAjB,EAA7B;AACMK,MAAAA,mBAAmB,GAAGL,kBAAkB,CAACM;;;;;"}
1
+ {"version":3,"file":"isRestoring.js","sources":["../../src/isRestoring.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nconst IsRestoringContext = React.createContext(false)\n\nexport const useIsRestoring = () => React.useContext(IsRestoringContext)\nexport const IsRestoringProvider = IsRestoringContext.Provider\n"],"names":["IsRestoringContext","React","createContext","useIsRestoring","useContext","IsRestoringProvider","Provider"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAMA,kBAAkB,gBAAGC,gBAAK,CAACC,aAAN,CAAoB,KAApB,CAA3B,CAAA;AAEO,MAAMC,cAAc,GAAG,MAAMF,gBAAK,CAACG,UAAN,CAAiBJ,kBAAjB,EAA7B;AACMK,MAAAA,mBAAmB,GAAGL,kBAAkB,CAACM;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"isRestoring.mjs","sources":["../../src/isRestoring.tsx"],"sourcesContent":["import * as React from 'react'\n\nconst IsRestoringContext = React.createContext(false)\n\nexport const useIsRestoring = () => React.useContext(IsRestoringContext)\nexport const IsRestoringProvider = IsRestoringContext.Provider\n"],"names":["IsRestoringContext","React","createContext","useIsRestoring","useContext","IsRestoringProvider","Provider"],"mappings":";;AAEA,MAAMA,kBAAkB,gBAAGC,KAAK,CAACC,aAAN,CAAoB,KAApB,CAA3B,CAAA;AAEO,MAAMC,cAAc,GAAG,MAAMF,KAAK,CAACG,UAAN,CAAiBJ,kBAAjB,EAA7B;AACMK,MAAAA,mBAAmB,GAAGL,kBAAkB,CAACM;;;;"}
1
+ {"version":3,"file":"isRestoring.mjs","sources":["../../src/isRestoring.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nconst IsRestoringContext = React.createContext(false)\n\nexport const useIsRestoring = () => React.useContext(IsRestoringContext)\nexport const IsRestoringProvider = IsRestoringContext.Provider\n"],"names":["IsRestoringContext","React","createContext","useIsRestoring","useContext","IsRestoringProvider","Provider"],"mappings":";;AAGA,MAAMA,kBAAkB,gBAAGC,KAAK,CAACC,aAAN,CAAoB,KAApB,CAA3B,CAAA;AAEO,MAAMC,cAAc,GAAG,MAAMF,KAAK,CAACG,UAAN,CAAiBJ,kBAAjB,EAA7B;AACMK,MAAAA,mBAAmB,GAAGL,kBAAkB,CAACM;;;;"}
@@ -3060,7 +3060,7 @@
3060
3060
  notify(options) {
3061
3061
  notifyManager.batch(() => {
3062
3062
  // First trigger the mutate callbacks
3063
- if (this.mutateOptions) {
3063
+ if (this.mutateOptions && this.hasListeners()) {
3064
3064
  if (options.onSuccess) {
3065
3065
  var _this$mutateOptions$o, _this$mutateOptions, _this$mutateOptions$o2, _this$mutateOptions2;
3066
3066