1import { o as __toESM } from "./chunk-6z4oVpB-.js"; 2import { t as require_react } from "./react-CCT1erMQ.js"; 3var import_react = /* @__PURE__ */ __toESM(require_react(), 1); 4var defaultContext = /* @__PURE__ */ import_react.createContext(void 0); 5var QueryClientSharingContext = /* @__PURE__ */ import_react.createContext(false); 6function getQueryClientContext(context, contextSharing) { 7 if (context) return context; 8 if (contextSharing && typeof window !== "undefined") { 9 if (!window.ReactQueryClientContext) window.ReactQueryClientContext = defaultContext; 10 return window.ReactQueryClientContext; 11 } 12 return defaultContext; 13} 14var useQueryClient = ({ context } = {}) => { 15 const queryClient = import_react.useContext(getQueryClientContext(context, import_react.useContext(QueryClientSharingContext))); 16 if (!queryClient) throw new Error("No QueryClient set, use QueryClientProvider to set one"); 17 return queryClient; 18}; 19var QueryClientProvider = ({ client, children, context, contextSharing = false }) => { 20 import_react.useEffect(() => { 21 client.mount(); 22 return () => { 23 client.unmount(); 24 }; 25 }, [client]); 26 if (contextSharing) client.getLogger().error("The contextSharing option has been deprecated and will be removed in the next major version"); 27 const Context = getQueryClientContext(context, contextSharing); 28 return /* @__PURE__ */ import_react.createElement(QueryClientSharingContext.Provider, { value: !context && contextSharing }, /* @__PURE__ */ import_react.createElement(Context.Provider, { value: client }, children)); 29}; 30export { useQueryClient as n, QueryClientProvider as t }; 31 32//# sourceMappingURL=QueryClientProvider-DBT_lM_H.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.