@tanstack/preact-query 5.102.2 → 5.102.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"HydrationBoundary.cjs","names":["useQueryClient","useRef","useMemo","Fragment"],"sources":["../../src/HydrationBoundary.tsx"],"sourcesContent":["import { hydrate } from '@tanstack/query-core'\nimport type {\n DehydratedState,\n HydrateOptions,\n OmitKeyof,\n QueryClient,\n} from '@tanstack/query-core'\nimport { Fragment } from 'preact'\nimport type { ComponentChildren } from 'preact'\nimport { useEffect, useMemo, useRef } from 'preact/hooks'\n\nimport { useQueryClient } from './QueryClientProvider'\n\nexport interface HydrationBoundaryProps {\n state: DehydratedState | null | undefined\n options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {\n defaultOptions?: OmitKeyof<\n Exclude<HydrateOptions['defaultOptions'], undefined>,\n 'mutations'\n >\n }\n children?: ComponentChildren\n queryClient?: QueryClient\n}\n\nexport const HydrationBoundary = ({\n children,\n options = {},\n state,\n queryClient,\n}: HydrationBoundaryProps) => {\n const client = useQueryClient(queryClient)\n\n const optionsRef = useRef(options)\n useEffect(() => {\n optionsRef.current = options\n })\n\n // This useMemo is for performance reasons only, everything inside it must\n // be safe to run in every render and code here should be read as \"in render\".\n //\n // This code needs to happen during the render phase, because after initial\n // SSR, hydration needs to happen _before_ children render. Also, if hydrating\n // during a transition, we want to hydrate as much as is safe in render so\n // we can prerender as much as possible.\n //\n // For any queries that already exist in the cache, we want to hold back on\n // hydrating until _after_ the render phase. The reason for this is that during\n // transitions, we don't want the existing queries and observers to update to\n // the new data on the current page, only _after_ the transition is committed.\n // If the transition is aborted, we will have hydrated any _new_ queries, but\n // we throw away the fresh data for any existing ones to avoid unexpectedly\n // updating the UI.\n const hydrationQueue: DehydratedState['queries'] | undefined = useMemo(() => {\n if (state) {\n if (typeof state !== 'object') {\n return\n }\n\n const queryCache = client.getQueryCache()\n // State is supplied from the outside and we might as well fail\n // gracefully if it has the wrong shape, so while we type `queries`\n // as required, we still provide a fallback.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const queries = state.queries || []\n\n const newQueries: DehydratedState['queries'] = []\n const existingQueries: DehydratedState['queries'] = []\n for (const dehydratedQuery of queries) {\n const existingQuery = queryCache.get(dehydratedQuery.queryHash)\n\n if (!existingQuery) {\n newQueries.push(dehydratedQuery)\n } else {\n const hydrationIsNewer =\n dehydratedQuery.state.dataUpdatedAt >\n existingQuery.state.dataUpdatedAt ||\n (dehydratedQuery.promise &&\n existingQuery.state.status !== 'pending' &&\n existingQuery.state.fetchStatus !== 'fetching' &&\n dehydratedQuery.dehydratedAt !== undefined &&\n dehydratedQuery.dehydratedAt > existingQuery.state.dataUpdatedAt)\n\n if (hydrationIsNewer) {\n existingQueries.push(dehydratedQuery)\n }\n }\n }\n\n if (newQueries.length > 0) {\n // It's actually fine to call this with queries/state that already exists\n // in the cache, or is older. hydrate() is idempotent for queries.\n hydrate(client, { queries: newQueries }, optionsRef.current)\n }\n if (existingQueries.length > 0) {\n return existingQueries\n }\n }\n return undefined\n }, [client, state])\n\n useEffect(() => {\n if (hydrationQueue) {\n hydrate(client, { queries: hydrationQueue }, optionsRef.current)\n }\n }, [client, hydrationQueue])\n\n return <Fragment>{children}</Fragment>\n}\n"],"mappings":";;;;;;;AAyBA,MAAa,qBAAqB,EAChC,UACA,UAAU,CAAC,GACX,OACA,kBAC4B;CAC5B,MAAM,SAASA,4BAAAA,eAAe,WAAW;CAEzC,MAAM,cAAA,GAAaC,aAAAA,OAAAA,CAAO,OAAO;CACjC,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,WAAW,UAAU;CACvB,CAAC;CAiBD,MAAM,kBAAA,GAAyDC,aAAAA,QAAAA,OAAc;EAC3E,IAAI,OAAO;GACT,IAAI,OAAO,UAAU,UACnB;GAGF,MAAM,aAAa,OAAO,cAAc;GAKxC,MAAM,UAAU,MAAM,WAAW,CAAC;GAElC,MAAM,aAAyC,CAAC;GAChD,MAAM,kBAA8C,CAAC;GACrD,KAAK,MAAM,mBAAmB,SAAS;IACrC,MAAM,gBAAgB,WAAW,IAAI,gBAAgB,SAAS;IAE9D,IAAI,CAAC,eACH,WAAW,KAAK,eAAe;SAW/B,IARE,gBAAgB,MAAM,gBACpB,cAAc,MAAM,iBACrB,gBAAgB,WACf,cAAc,MAAM,WAAW,aAC/B,cAAc,MAAM,gBAAgB,cACpC,gBAAgB,iBAAiB,KAAA,KACjC,gBAAgB,eAAe,cAAc,MAAM,eAGrD,gBAAgB,KAAK,eAAe;GAG1C;GAEA,IAAI,WAAW,SAAS,GAGtB,CAAA,GAAA,qBAAA,QAAA,CAAQ,QAAQ,EAAE,SAAS,WAAW,GAAG,WAAW,OAAO;GAE7D,IAAI,gBAAgB,SAAS,GAC3B,OAAO;EAEX;CAEF,GAAG,CAAC,QAAQ,KAAK,CAAC;CAElB,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,IAAI,gBACF,CAAA,GAAA,qBAAA,QAAA,CAAQ,QAAQ,EAAE,SAAS,eAAe,GAAG,WAAW,OAAO;CAEnE,GAAG,CAAC,QAAQ,cAAc,CAAC;CAE3B,OAAO,iBAAA,GAAA,mBAAA,IAAA,CAACC,OAAAA,UAAD,EAAW,SAAmB,CAAA;AACvC"}
1
+ {"version":3,"file":"HydrationBoundary.cjs","names":["useQueryClient","useRef","useMemo","Fragment"],"sources":["../../src/HydrationBoundary.tsx"],"sourcesContent":["import { hydrate } from '@tanstack/query-core'\nimport type {\n DehydratedState,\n HydrateOptions,\n OmitKeyof,\n QueryClient,\n} from '@tanstack/query-core'\nimport { Fragment } from 'preact'\nimport type { ComponentChildren } from 'preact'\nimport { useEffect, useMemo, useRef } from 'preact/hooks'\n\nimport { useQueryClient } from './QueryClientProvider'\n\nexport interface HydrationBoundaryProps {\n state: DehydratedState | null | undefined\n options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {\n defaultOptions?: OmitKeyof<\n Exclude<HydrateOptions['defaultOptions'], undefined>,\n 'mutations'\n >\n }\n children?: ComponentChildren\n queryClient?: QueryClient\n}\n\nexport const HydrationBoundary = ({\n children,\n options = {},\n state,\n queryClient,\n}: HydrationBoundaryProps) => {\n const client = useQueryClient(queryClient)\n\n const optionsRef = useRef(options)\n useEffect(() => {\n optionsRef.current = options\n })\n\n // This useMemo is for performance reasons only, everything inside it must\n // be safe to run in every render and code here should be read as \"in render\".\n //\n // This code needs to happen during the render phase, because after initial\n // SSR, hydration needs to happen _before_ children render. Also, if hydrating\n // during a transition, we want to hydrate as much as is safe in render so\n // we can prerender as much as possible.\n //\n // For any queries that already exist in the cache, we want to hold back on\n // hydrating until _after_ the render phase. The reason for this is that during\n // transitions, we don't want the existing queries and observers to update to\n // the new data on the current page, only _after_ the transition is committed.\n // If the transition is aborted, we will have hydrated any _new_ queries, but\n // we throw away the fresh data for any existing ones to avoid unexpectedly\n // updating the UI.\n const hydrationQueue: DehydratedState['queries'] | undefined = useMemo(() => {\n if (state) {\n if (typeof state !== 'object') {\n return\n }\n\n const queryCache = client.getQueryCache()\n // State is supplied from the outside and we might as well fail\n // gracefully if it has the wrong shape, so while we type `queries`\n // as required, we still provide a fallback.\n const queries = state.queries || []\n\n const newQueries: DehydratedState['queries'] = []\n const existingQueries: DehydratedState['queries'] = []\n for (const dehydratedQuery of queries) {\n const existingQuery = queryCache.get(dehydratedQuery.queryHash)\n\n if (!existingQuery) {\n newQueries.push(dehydratedQuery)\n } else {\n const hydrationIsNewer =\n dehydratedQuery.state.dataUpdatedAt >\n existingQuery.state.dataUpdatedAt ||\n (dehydratedQuery.promise &&\n existingQuery.state.status !== 'pending' &&\n existingQuery.state.fetchStatus !== 'fetching' &&\n dehydratedQuery.dehydratedAt !== undefined &&\n dehydratedQuery.dehydratedAt > existingQuery.state.dataUpdatedAt)\n\n if (hydrationIsNewer) {\n existingQueries.push(dehydratedQuery)\n }\n }\n }\n\n if (newQueries.length > 0) {\n // It's actually fine to call this with queries/state that already exists\n // in the cache, or is older. hydrate() is idempotent for queries.\n hydrate(client, { queries: newQueries }, optionsRef.current)\n }\n if (existingQueries.length > 0) {\n return existingQueries\n }\n }\n return undefined\n }, [client, state])\n\n useEffect(() => {\n if (hydrationQueue) {\n hydrate(client, { queries: hydrationQueue }, optionsRef.current)\n }\n }, [client, hydrationQueue])\n\n return <Fragment>{children}</Fragment>\n}\n"],"mappings":";;;;;;;AAyBA,MAAa,qBAAqB,EAChC,UACA,UAAU,CAAC,GACX,OACA,kBAC4B;CAC5B,MAAM,SAASA,4BAAAA,eAAe,WAAW;CAEzC,MAAM,cAAA,GAAaC,aAAAA,OAAAA,CAAO,OAAO;CACjC,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,WAAW,UAAU;CACvB,CAAC;CAiBD,MAAM,kBAAA,GAAyDC,aAAAA,QAAAA,OAAc;EAC3E,IAAI,OAAO;GACT,IAAI,OAAO,UAAU,UACnB;GAGF,MAAM,aAAa,OAAO,cAAc;GAIxC,MAAM,UAAU,MAAM,WAAW,CAAC;GAElC,MAAM,aAAyC,CAAC;GAChD,MAAM,kBAA8C,CAAC;GACrD,KAAK,MAAM,mBAAmB,SAAS;IACrC,MAAM,gBAAgB,WAAW,IAAI,gBAAgB,SAAS;IAE9D,IAAI,CAAC,eACH,WAAW,KAAK,eAAe;SAW/B,IARE,gBAAgB,MAAM,gBACpB,cAAc,MAAM,iBACrB,gBAAgB,WACf,cAAc,MAAM,WAAW,aAC/B,cAAc,MAAM,gBAAgB,cACpC,gBAAgB,iBAAiB,KAAA,KACjC,gBAAgB,eAAe,cAAc,MAAM,eAGrD,gBAAgB,KAAK,eAAe;GAG1C;GAEA,IAAI,WAAW,SAAS,GAGtB,CAAA,GAAA,qBAAA,QAAA,CAAQ,QAAQ,EAAE,SAAS,WAAW,GAAG,WAAW,OAAO;GAE7D,IAAI,gBAAgB,SAAS,GAC3B,OAAO;EAEX;CAEF,GAAG,CAAC,QAAQ,KAAK,CAAC;CAElB,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,IAAI,gBACF,CAAA,GAAA,qBAAA,QAAA,CAAQ,QAAQ,EAAE,SAAS,eAAe,GAAG,WAAW,OAAO;CAEnE,GAAG,CAAC,QAAQ,cAAc,CAAC;CAE3B,OAAO,iBAAA,GAAA,mBAAA,IAAA,CAACC,OAAAA,UAAD,EAAW,SAAmB,CAAA;AACvC"}
@@ -1 +1 @@
1
- {"version":3,"file":"HydrationBoundary.js","names":[],"sources":["../../src/HydrationBoundary.tsx"],"sourcesContent":["import { hydrate } from '@tanstack/query-core'\nimport type {\n DehydratedState,\n HydrateOptions,\n OmitKeyof,\n QueryClient,\n} from '@tanstack/query-core'\nimport { Fragment } from 'preact'\nimport type { ComponentChildren } from 'preact'\nimport { useEffect, useMemo, useRef } from 'preact/hooks'\n\nimport { useQueryClient } from './QueryClientProvider'\n\nexport interface HydrationBoundaryProps {\n state: DehydratedState | null | undefined\n options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {\n defaultOptions?: OmitKeyof<\n Exclude<HydrateOptions['defaultOptions'], undefined>,\n 'mutations'\n >\n }\n children?: ComponentChildren\n queryClient?: QueryClient\n}\n\nexport const HydrationBoundary = ({\n children,\n options = {},\n state,\n queryClient,\n}: HydrationBoundaryProps) => {\n const client = useQueryClient(queryClient)\n\n const optionsRef = useRef(options)\n useEffect(() => {\n optionsRef.current = options\n })\n\n // This useMemo is for performance reasons only, everything inside it must\n // be safe to run in every render and code here should be read as \"in render\".\n //\n // This code needs to happen during the render phase, because after initial\n // SSR, hydration needs to happen _before_ children render. Also, if hydrating\n // during a transition, we want to hydrate as much as is safe in render so\n // we can prerender as much as possible.\n //\n // For any queries that already exist in the cache, we want to hold back on\n // hydrating until _after_ the render phase. The reason for this is that during\n // transitions, we don't want the existing queries and observers to update to\n // the new data on the current page, only _after_ the transition is committed.\n // If the transition is aborted, we will have hydrated any _new_ queries, but\n // we throw away the fresh data for any existing ones to avoid unexpectedly\n // updating the UI.\n const hydrationQueue: DehydratedState['queries'] | undefined = useMemo(() => {\n if (state) {\n if (typeof state !== 'object') {\n return\n }\n\n const queryCache = client.getQueryCache()\n // State is supplied from the outside and we might as well fail\n // gracefully if it has the wrong shape, so while we type `queries`\n // as required, we still provide a fallback.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const queries = state.queries || []\n\n const newQueries: DehydratedState['queries'] = []\n const existingQueries: DehydratedState['queries'] = []\n for (const dehydratedQuery of queries) {\n const existingQuery = queryCache.get(dehydratedQuery.queryHash)\n\n if (!existingQuery) {\n newQueries.push(dehydratedQuery)\n } else {\n const hydrationIsNewer =\n dehydratedQuery.state.dataUpdatedAt >\n existingQuery.state.dataUpdatedAt ||\n (dehydratedQuery.promise &&\n existingQuery.state.status !== 'pending' &&\n existingQuery.state.fetchStatus !== 'fetching' &&\n dehydratedQuery.dehydratedAt !== undefined &&\n dehydratedQuery.dehydratedAt > existingQuery.state.dataUpdatedAt)\n\n if (hydrationIsNewer) {\n existingQueries.push(dehydratedQuery)\n }\n }\n }\n\n if (newQueries.length > 0) {\n // It's actually fine to call this with queries/state that already exists\n // in the cache, or is older. hydrate() is idempotent for queries.\n hydrate(client, { queries: newQueries }, optionsRef.current)\n }\n if (existingQueries.length > 0) {\n return existingQueries\n }\n }\n return undefined\n }, [client, state])\n\n useEffect(() => {\n if (hydrationQueue) {\n hydrate(client, { queries: hydrationQueue }, optionsRef.current)\n }\n }, [client, hydrationQueue])\n\n return <Fragment>{children}</Fragment>\n}\n"],"mappings":";;;;;;AAyBA,MAAa,qBAAqB,EAChC,UACA,UAAU,CAAC,GACX,OACA,kBAC4B;CAC5B,MAAM,SAAS,eAAe,WAAW;CAEzC,MAAM,aAAa,OAAO,OAAO;CACjC,gBAAgB;EACd,WAAW,UAAU;CACvB,CAAC;CAiBD,MAAM,iBAAyD,cAAc;EAC3E,IAAI,OAAO;GACT,IAAI,OAAO,UAAU,UACnB;GAGF,MAAM,aAAa,OAAO,cAAc;GAKxC,MAAM,UAAU,MAAM,WAAW,CAAC;GAElC,MAAM,aAAyC,CAAC;GAChD,MAAM,kBAA8C,CAAC;GACrD,KAAK,MAAM,mBAAmB,SAAS;IACrC,MAAM,gBAAgB,WAAW,IAAI,gBAAgB,SAAS;IAE9D,IAAI,CAAC,eACH,WAAW,KAAK,eAAe;SAW/B,IARE,gBAAgB,MAAM,gBACpB,cAAc,MAAM,iBACrB,gBAAgB,WACf,cAAc,MAAM,WAAW,aAC/B,cAAc,MAAM,gBAAgB,cACpC,gBAAgB,iBAAiB,KAAA,KACjC,gBAAgB,eAAe,cAAc,MAAM,eAGrD,gBAAgB,KAAK,eAAe;GAG1C;GAEA,IAAI,WAAW,SAAS,GAGtB,QAAQ,QAAQ,EAAE,SAAS,WAAW,GAAG,WAAW,OAAO;GAE7D,IAAI,gBAAgB,SAAS,GAC3B,OAAO;EAEX;CAEF,GAAG,CAAC,QAAQ,KAAK,CAAC;CAElB,gBAAgB;EACd,IAAI,gBACF,QAAQ,QAAQ,EAAE,SAAS,eAAe,GAAG,WAAW,OAAO;CAEnE,GAAG,CAAC,QAAQ,cAAc,CAAC;CAE3B,OAAO,oBAAC,UAAD,EAAW,SAAmB,CAAA;AACvC"}
1
+ {"version":3,"file":"HydrationBoundary.js","names":[],"sources":["../../src/HydrationBoundary.tsx"],"sourcesContent":["import { hydrate } from '@tanstack/query-core'\nimport type {\n DehydratedState,\n HydrateOptions,\n OmitKeyof,\n QueryClient,\n} from '@tanstack/query-core'\nimport { Fragment } from 'preact'\nimport type { ComponentChildren } from 'preact'\nimport { useEffect, useMemo, useRef } from 'preact/hooks'\n\nimport { useQueryClient } from './QueryClientProvider'\n\nexport interface HydrationBoundaryProps {\n state: DehydratedState | null | undefined\n options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {\n defaultOptions?: OmitKeyof<\n Exclude<HydrateOptions['defaultOptions'], undefined>,\n 'mutations'\n >\n }\n children?: ComponentChildren\n queryClient?: QueryClient\n}\n\nexport const HydrationBoundary = ({\n children,\n options = {},\n state,\n queryClient,\n}: HydrationBoundaryProps) => {\n const client = useQueryClient(queryClient)\n\n const optionsRef = useRef(options)\n useEffect(() => {\n optionsRef.current = options\n })\n\n // This useMemo is for performance reasons only, everything inside it must\n // be safe to run in every render and code here should be read as \"in render\".\n //\n // This code needs to happen during the render phase, because after initial\n // SSR, hydration needs to happen _before_ children render. Also, if hydrating\n // during a transition, we want to hydrate as much as is safe in render so\n // we can prerender as much as possible.\n //\n // For any queries that already exist in the cache, we want to hold back on\n // hydrating until _after_ the render phase. The reason for this is that during\n // transitions, we don't want the existing queries and observers to update to\n // the new data on the current page, only _after_ the transition is committed.\n // If the transition is aborted, we will have hydrated any _new_ queries, but\n // we throw away the fresh data for any existing ones to avoid unexpectedly\n // updating the UI.\n const hydrationQueue: DehydratedState['queries'] | undefined = useMemo(() => {\n if (state) {\n if (typeof state !== 'object') {\n return\n }\n\n const queryCache = client.getQueryCache()\n // State is supplied from the outside and we might as well fail\n // gracefully if it has the wrong shape, so while we type `queries`\n // as required, we still provide a fallback.\n const queries = state.queries || []\n\n const newQueries: DehydratedState['queries'] = []\n const existingQueries: DehydratedState['queries'] = []\n for (const dehydratedQuery of queries) {\n const existingQuery = queryCache.get(dehydratedQuery.queryHash)\n\n if (!existingQuery) {\n newQueries.push(dehydratedQuery)\n } else {\n const hydrationIsNewer =\n dehydratedQuery.state.dataUpdatedAt >\n existingQuery.state.dataUpdatedAt ||\n (dehydratedQuery.promise &&\n existingQuery.state.status !== 'pending' &&\n existingQuery.state.fetchStatus !== 'fetching' &&\n dehydratedQuery.dehydratedAt !== undefined &&\n dehydratedQuery.dehydratedAt > existingQuery.state.dataUpdatedAt)\n\n if (hydrationIsNewer) {\n existingQueries.push(dehydratedQuery)\n }\n }\n }\n\n if (newQueries.length > 0) {\n // It's actually fine to call this with queries/state that already exists\n // in the cache, or is older. hydrate() is idempotent for queries.\n hydrate(client, { queries: newQueries }, optionsRef.current)\n }\n if (existingQueries.length > 0) {\n return existingQueries\n }\n }\n return undefined\n }, [client, state])\n\n useEffect(() => {\n if (hydrationQueue) {\n hydrate(client, { queries: hydrationQueue }, optionsRef.current)\n }\n }, [client, hydrationQueue])\n\n return <Fragment>{children}</Fragment>\n}\n"],"mappings":";;;;;;AAyBA,MAAa,qBAAqB,EAChC,UACA,UAAU,CAAC,GACX,OACA,kBAC4B;CAC5B,MAAM,SAAS,eAAe,WAAW;CAEzC,MAAM,aAAa,OAAO,OAAO;CACjC,gBAAgB;EACd,WAAW,UAAU;CACvB,CAAC;CAiBD,MAAM,iBAAyD,cAAc;EAC3E,IAAI,OAAO;GACT,IAAI,OAAO,UAAU,UACnB;GAGF,MAAM,aAAa,OAAO,cAAc;GAIxC,MAAM,UAAU,MAAM,WAAW,CAAC;GAElC,MAAM,aAAyC,CAAC;GAChD,MAAM,kBAA8C,CAAC;GACrD,KAAK,MAAM,mBAAmB,SAAS;IACrC,MAAM,gBAAgB,WAAW,IAAI,gBAAgB,SAAS;IAE9D,IAAI,CAAC,eACH,WAAW,KAAK,eAAe;SAW/B,IARE,gBAAgB,MAAM,gBACpB,cAAc,MAAM,iBACrB,gBAAgB,WACf,cAAc,MAAM,WAAW,aAC/B,cAAc,MAAM,gBAAgB,cACpC,gBAAgB,iBAAiB,KAAA,KACjC,gBAAgB,eAAe,cAAc,MAAM,eAGrD,gBAAgB,KAAK,eAAe;GAG1C;GAEA,IAAI,WAAW,SAAS,GAGtB,QAAQ,QAAQ,EAAE,SAAS,WAAW,GAAG,WAAW,OAAO;GAE7D,IAAI,gBAAgB,SAAS,GAC3B,OAAO;EAEX;CAEF,GAAG,CAAC,QAAQ,KAAK,CAAC;CAElB,gBAAgB;EACd,IAAI,gBACF,QAAQ,QAAQ,EAAE,SAAS,eAAe,GAAG,WAAW,OAAO;CAEnE,GAAG,CAAC,QAAQ,cAAc,CAAC;CAE3B,OAAO,oBAAC,UAAD,EAAW,SAAmB,CAAA;AACvC"}
@@ -4,7 +4,7 @@ let _tanstack_query_core = require("@tanstack/query-core");
4
4
  //#region src/usePrefetchQuery.tsx
5
5
  function usePrefetchQuery(options, queryClient) {
6
6
  const client = require_QueryClientProvider.useQueryClient(queryClient);
7
- if (!client.getQueryState(options.queryKey)) client.fetchQuery(options).catch(_tanstack_query_core.noop);
7
+ if (!client.getQueryState(options.queryKey)) client.query(options).catch(_tanstack_query_core.noop);
8
8
  }
9
9
  //#endregion
10
10
  exports.usePrefetchQuery = usePrefetchQuery;
@@ -1 +1 @@
1
- {"version":3,"file":"usePrefetchQuery.cjs","names":["useQueryClient","noop"],"sources":["../../src/usePrefetchQuery.tsx"],"sourcesContent":["import { noop } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\n\nimport type { DefaultError, QueryClient, QueryKey } from '@tanstack/query-core'\nimport type { UsePrefetchQueryOptions } from './types'\n\nexport function usePrefetchQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UsePrefetchQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n queryClient?: QueryClient,\n) {\n const client = useQueryClient(queryClient)\n\n if (!client.getQueryState(options.queryKey)) {\n void client.fetchQuery(options).catch(noop)\n }\n}\n"],"mappings":";;;;AAMA,SAAgB,iBAOd,SAOA,aACA;CACA,MAAM,SAASA,4BAAAA,eAAe,WAAW;CAEzC,IAAI,CAAC,OAAO,cAAc,QAAQ,QAAQ,GACxC,OAAY,WAAW,OAAO,CAAC,CAAC,MAAMC,qBAAAA,IAAI;AAE9C"}
1
+ {"version":3,"file":"usePrefetchQuery.cjs","names":["useQueryClient","noop"],"sources":["../../src/usePrefetchQuery.tsx"],"sourcesContent":["import { noop } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\n\nimport type { DefaultError, QueryClient, QueryKey } from '@tanstack/query-core'\nimport type { UsePrefetchQueryOptions } from './types'\n\nexport function usePrefetchQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UsePrefetchQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n queryClient?: QueryClient,\n) {\n const client = useQueryClient(queryClient)\n\n if (!client.getQueryState(options.queryKey)) {\n void client.query(options).catch(noop)\n }\n}\n"],"mappings":";;;;AAMA,SAAgB,iBAOd,SAOA,aACA;CACA,MAAM,SAASA,4BAAAA,eAAe,WAAW;CAEzC,IAAI,CAAC,OAAO,cAAc,QAAQ,QAAQ,GACxC,OAAY,MAAM,OAAO,CAAC,CAAC,MAAMC,qBAAAA,IAAI;AAEzC"}
@@ -3,7 +3,7 @@ import { noop } from "@tanstack/query-core";
3
3
  //#region src/usePrefetchQuery.tsx
4
4
  function usePrefetchQuery(options, queryClient) {
5
5
  const client = useQueryClient(queryClient);
6
- if (!client.getQueryState(options.queryKey)) client.fetchQuery(options).catch(noop);
6
+ if (!client.getQueryState(options.queryKey)) client.query(options).catch(noop);
7
7
  }
8
8
  //#endregion
9
9
  export { usePrefetchQuery };
@@ -1 +1 @@
1
- {"version":3,"file":"usePrefetchQuery.js","names":[],"sources":["../../src/usePrefetchQuery.tsx"],"sourcesContent":["import { noop } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\n\nimport type { DefaultError, QueryClient, QueryKey } from '@tanstack/query-core'\nimport type { UsePrefetchQueryOptions } from './types'\n\nexport function usePrefetchQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UsePrefetchQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n queryClient?: QueryClient,\n) {\n const client = useQueryClient(queryClient)\n\n if (!client.getQueryState(options.queryKey)) {\n void client.fetchQuery(options).catch(noop)\n }\n}\n"],"mappings":";;;AAMA,SAAgB,iBAOd,SAOA,aACA;CACA,MAAM,SAAS,eAAe,WAAW;CAEzC,IAAI,CAAC,OAAO,cAAc,QAAQ,QAAQ,GACxC,OAAY,WAAW,OAAO,CAAC,CAAC,MAAM,IAAI;AAE9C"}
1
+ {"version":3,"file":"usePrefetchQuery.js","names":[],"sources":["../../src/usePrefetchQuery.tsx"],"sourcesContent":["import { noop } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\n\nimport type { DefaultError, QueryClient, QueryKey } from '@tanstack/query-core'\nimport type { UsePrefetchQueryOptions } from './types'\n\nexport function usePrefetchQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UsePrefetchQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n queryClient?: QueryClient,\n) {\n const client = useQueryClient(queryClient)\n\n if (!client.getQueryState(options.queryKey)) {\n void client.query(options).catch(noop)\n }\n}\n"],"mappings":";;;AAMA,SAAgB,iBAOd,SAOA,aACA;CACA,MAAM,SAAS,eAAe,WAAW;CAEzC,IAAI,CAAC,OAAO,cAAc,QAAQ,QAAQ,GACxC,OAAY,MAAM,OAAO,CAAC,CAAC,MAAM,IAAI;AAEzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.cjs","names":["useState","useRef"],"sources":["../../src/utils.ts"],"sourcesContent":["import { useEffect, useLayoutEffect, useRef, useState } from 'preact/hooks'\n\n/**\n * This is taken from https://github.com/preactjs/preact/blob/main/compat/src/hooks.js#L8-L54\n * which is taken from https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreShimClient.js#L84\n * on a high level this cuts out the warnings, ... and attempts a smaller implementation.\n * This way we don't have to import preact/compat with side effects\n */\ntype InternalStore = {\n _value: any\n _getSnapshot: () => any\n}\ntype StoreRef = {\n _instance: InternalStore\n}\nexport function useSyncExternalStore(\n subscribe: (onStoreChange: () => void) => () => void,\n getSnapshot: () => any,\n) {\n const value = getSnapshot()\n\n const [{ _instance }, forceUpdate] = useState<StoreRef>({\n _instance: { _value: value, _getSnapshot: getSnapshot },\n })\n\n useLayoutEffect(() => {\n _instance._value = value\n _instance._getSnapshot = getSnapshot\n\n if (didSnapshotChange(_instance)) {\n forceUpdate({ _instance })\n }\n }, [subscribe, value, getSnapshot])\n\n useEffect(() => {\n if (didSnapshotChange(_instance)) {\n forceUpdate({ _instance })\n }\n\n return subscribe(() => {\n if (didSnapshotChange(_instance)) {\n forceUpdate({ _instance })\n }\n })\n }, [subscribe])\n\n return value\n}\n\nfunction didSnapshotChange(inst: {\n _getSnapshot: () => any\n _value: any\n}): boolean {\n const latestGetSnapshot = inst._getSnapshot\n const prevValue = inst._value\n try {\n const nextValue = latestGetSnapshot()\n return !Object.is(prevValue, nextValue)\n // eslint-disable-next-line no-unused-vars\n } catch (_error) {\n return true\n }\n}\n\nexport function useSyncExternalStoreWithSelector<TSnapshot, TSelected>(\n subscribe: (onStoreChange: () => void) => () => void,\n getSnapshot: () => TSnapshot,\n selector: (snapshot: TSnapshot) => TSelected,\n isEqual: (a: TSelected, b: TSelected) => boolean,\n): TSelected {\n const selectedSnapshotRef = useRef<TSelected | undefined>()\n\n const getSelectedSnapshot = () => {\n const snapshot = getSnapshot()\n const selected = selector(snapshot)\n\n if (\n selectedSnapshotRef.current === undefined ||\n !isEqual(selectedSnapshotRef.current, selected)\n ) {\n selectedSnapshotRef.current = selected\n }\n\n return selectedSnapshotRef.current\n }\n\n return useSyncExternalStore(subscribe, getSelectedSnapshot)\n}\n"],"mappings":";;;AAeA,SAAgB,qBACd,WACA,aACA;CACA,MAAM,QAAQ,YAAY;CAE1B,MAAM,CAAC,EAAE,aAAa,gBAAA,GAAeA,aAAAA,SAAAA,CAAmB,EACtD,WAAW;EAAE,QAAQ;EAAO,cAAc;CAAY,EACxD,CAAC;CAED,CAAA,GAAA,aAAA,gBAAA,OAAsB;EACpB,UAAU,SAAS;EACnB,UAAU,eAAe;EAEzB,IAAI,kBAAkB,SAAS,GAC7B,YAAY,EAAE,UAAU,CAAC;CAE7B,GAAG;EAAC;EAAW;EAAO;CAAW,CAAC;CAElC,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,IAAI,kBAAkB,SAAS,GAC7B,YAAY,EAAE,UAAU,CAAC;EAG3B,OAAO,gBAAgB;GACrB,IAAI,kBAAkB,SAAS,GAC7B,YAAY,EAAE,UAAU,CAAC;EAE7B,CAAC;CACH,GAAG,CAAC,SAAS,CAAC;CAEd,OAAO;AACT;AAEA,SAAS,kBAAkB,MAGf;CACV,MAAM,oBAAoB,KAAK;CAC/B,MAAM,YAAY,KAAK;CACvB,IAAI;EACF,MAAM,YAAY,kBAAkB;EACpC,OAAO,CAAC,OAAO,GAAG,WAAW,SAAS;CAExC,SAAS,QAAQ;EACf,OAAO;CACT;AACF;AAEA,SAAgB,iCACd,WACA,aACA,UACA,SACW;CACX,MAAM,uBAAA,GAAsBC,aAAAA,OAAAA,CAA8B;CAE1D,MAAM,4BAA4B;EAEhC,MAAM,WAAW,SADA,YACgB,CAAC;EAElC,IACE,oBAAoB,YAAY,KAAA,KAChC,CAAC,QAAQ,oBAAoB,SAAS,QAAQ,GAE9C,oBAAoB,UAAU;EAGhC,OAAO,oBAAoB;CAC7B;CAEA,OAAO,qBAAqB,WAAW,mBAAmB;AAC5D"}
1
+ {"version":3,"file":"utils.cjs","names":["useState","useRef"],"sources":["../../src/utils.ts"],"sourcesContent":["import { useEffect, useLayoutEffect, useRef, useState } from 'preact/hooks'\n\n/**\n * This is taken from https://github.com/preactjs/preact/blob/main/compat/src/hooks.js#L8-L54\n * which is taken from https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreShimClient.js#L84\n * on a high level this cuts out the warnings, ... and attempts a smaller implementation.\n * This way we don't have to import preact/compat with side effects\n */\ntype InternalStore = {\n _value: any\n _getSnapshot: () => any\n}\ntype StoreRef = {\n _instance: InternalStore\n}\nexport function useSyncExternalStore(\n subscribe: (onStoreChange: () => void) => () => void,\n getSnapshot: () => any,\n) {\n const value = getSnapshot()\n\n const [{ _instance }, forceUpdate] = useState<StoreRef>({\n _instance: { _value: value, _getSnapshot: getSnapshot },\n })\n\n useLayoutEffect(() => {\n _instance._value = value\n _instance._getSnapshot = getSnapshot\n\n if (didSnapshotChange(_instance)) {\n forceUpdate({ _instance })\n }\n }, [subscribe, value, getSnapshot])\n\n useEffect(() => {\n if (didSnapshotChange(_instance)) {\n forceUpdate({ _instance })\n }\n\n return subscribe(() => {\n if (didSnapshotChange(_instance)) {\n forceUpdate({ _instance })\n }\n })\n }, [subscribe])\n\n return value\n}\n\nfunction didSnapshotChange(inst: {\n _getSnapshot: () => any\n _value: any\n}): boolean {\n const latestGetSnapshot = inst._getSnapshot\n const prevValue = inst._value\n try {\n const nextValue = latestGetSnapshot()\n return !Object.is(prevValue, nextValue)\n } catch (_error) {\n return true\n }\n}\n\nexport function useSyncExternalStoreWithSelector<TSnapshot, TSelected>(\n subscribe: (onStoreChange: () => void) => () => void,\n getSnapshot: () => TSnapshot,\n selector: (snapshot: TSnapshot) => TSelected,\n isEqual: (a: TSelected, b: TSelected) => boolean,\n): TSelected {\n const selectedSnapshotRef = useRef<TSelected | undefined>()\n\n const getSelectedSnapshot = () => {\n const snapshot = getSnapshot()\n const selected = selector(snapshot)\n\n if (\n selectedSnapshotRef.current === undefined ||\n !isEqual(selectedSnapshotRef.current, selected)\n ) {\n selectedSnapshotRef.current = selected\n }\n\n return selectedSnapshotRef.current\n }\n\n return useSyncExternalStore(subscribe, getSelectedSnapshot)\n}\n"],"mappings":";;;AAeA,SAAgB,qBACd,WACA,aACA;CACA,MAAM,QAAQ,YAAY;CAE1B,MAAM,CAAC,EAAE,aAAa,gBAAA,GAAeA,aAAAA,SAAAA,CAAmB,EACtD,WAAW;EAAE,QAAQ;EAAO,cAAc;CAAY,EACxD,CAAC;CAED,CAAA,GAAA,aAAA,gBAAA,OAAsB;EACpB,UAAU,SAAS;EACnB,UAAU,eAAe;EAEzB,IAAI,kBAAkB,SAAS,GAC7B,YAAY,EAAE,UAAU,CAAC;CAE7B,GAAG;EAAC;EAAW;EAAO;CAAW,CAAC;CAElC,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,IAAI,kBAAkB,SAAS,GAC7B,YAAY,EAAE,UAAU,CAAC;EAG3B,OAAO,gBAAgB;GACrB,IAAI,kBAAkB,SAAS,GAC7B,YAAY,EAAE,UAAU,CAAC;EAE7B,CAAC;CACH,GAAG,CAAC,SAAS,CAAC;CAEd,OAAO;AACT;AAEA,SAAS,kBAAkB,MAGf;CACV,MAAM,oBAAoB,KAAK;CAC/B,MAAM,YAAY,KAAK;CACvB,IAAI;EACF,MAAM,YAAY,kBAAkB;EACpC,OAAO,CAAC,OAAO,GAAG,WAAW,SAAS;CACxC,SAAS,QAAQ;EACf,OAAO;CACT;AACF;AAEA,SAAgB,iCACd,WACA,aACA,UACA,SACW;CACX,MAAM,uBAAA,GAAsBC,aAAAA,OAAAA,CAA8B;CAE1D,MAAM,4BAA4B;EAEhC,MAAM,WAAW,SADA,YACgB,CAAC;EAElC,IACE,oBAAoB,YAAY,KAAA,KAChC,CAAC,QAAQ,oBAAoB,SAAS,QAAQ,GAE9C,oBAAoB,UAAU;EAGhC,OAAO,oBAAoB;CAC7B;CAEA,OAAO,qBAAqB,WAAW,mBAAmB;AAC5D"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.cts","names":[],"sources":["../../src/utils.ts"],"mappings":";iBAegB,qBACd,YAAY,0CACZ;iBA+Cc,iCAAiC,WAAW,WAC1D,YAAY,0CACZ,mBAAmB,WACnB,WAAW,UAAU,cAAc,WACnC,UAAU,GAAG,WAAW,GAAG,wBAC1B"}
1
+ {"version":3,"file":"utils.d.cts","names":[],"sources":["../../src/utils.ts"],"mappings":";iBAegB,qBACd,YAAY,0CACZ;iBA8Cc,iCAAiC,WAAW,WAC1D,YAAY,0CACZ,mBAAmB,WACnB,WAAW,UAAU,cAAc,WACnC,UAAU,GAAG,WAAW,GAAG,wBAC1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/utils.ts"],"mappings":";iBAegB,qBACd,YAAY,0CACZ;iBA+Cc,iCAAiC,WAAW,WAC1D,YAAY,0CACZ,mBAAmB,WACnB,WAAW,UAAU,cAAc,WACnC,UAAU,GAAG,WAAW,GAAG,wBAC1B"}
1
+ {"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/utils.ts"],"mappings":";iBAegB,qBACd,YAAY,0CACZ;iBA8Cc,iCAAiC,WAAW,WAC1D,YAAY,0CACZ,mBAAmB,WACnB,WAAW,UAAU,cAAc,WACnC,UAAU,GAAG,WAAW,GAAG,wBAC1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":[],"sources":["../../src/utils.ts"],"sourcesContent":["import { useEffect, useLayoutEffect, useRef, useState } from 'preact/hooks'\n\n/**\n * This is taken from https://github.com/preactjs/preact/blob/main/compat/src/hooks.js#L8-L54\n * which is taken from https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreShimClient.js#L84\n * on a high level this cuts out the warnings, ... and attempts a smaller implementation.\n * This way we don't have to import preact/compat with side effects\n */\ntype InternalStore = {\n _value: any\n _getSnapshot: () => any\n}\ntype StoreRef = {\n _instance: InternalStore\n}\nexport function useSyncExternalStore(\n subscribe: (onStoreChange: () => void) => () => void,\n getSnapshot: () => any,\n) {\n const value = getSnapshot()\n\n const [{ _instance }, forceUpdate] = useState<StoreRef>({\n _instance: { _value: value, _getSnapshot: getSnapshot },\n })\n\n useLayoutEffect(() => {\n _instance._value = value\n _instance._getSnapshot = getSnapshot\n\n if (didSnapshotChange(_instance)) {\n forceUpdate({ _instance })\n }\n }, [subscribe, value, getSnapshot])\n\n useEffect(() => {\n if (didSnapshotChange(_instance)) {\n forceUpdate({ _instance })\n }\n\n return subscribe(() => {\n if (didSnapshotChange(_instance)) {\n forceUpdate({ _instance })\n }\n })\n }, [subscribe])\n\n return value\n}\n\nfunction didSnapshotChange(inst: {\n _getSnapshot: () => any\n _value: any\n}): boolean {\n const latestGetSnapshot = inst._getSnapshot\n const prevValue = inst._value\n try {\n const nextValue = latestGetSnapshot()\n return !Object.is(prevValue, nextValue)\n // eslint-disable-next-line no-unused-vars\n } catch (_error) {\n return true\n }\n}\n\nexport function useSyncExternalStoreWithSelector<TSnapshot, TSelected>(\n subscribe: (onStoreChange: () => void) => () => void,\n getSnapshot: () => TSnapshot,\n selector: (snapshot: TSnapshot) => TSelected,\n isEqual: (a: TSelected, b: TSelected) => boolean,\n): TSelected {\n const selectedSnapshotRef = useRef<TSelected | undefined>()\n\n const getSelectedSnapshot = () => {\n const snapshot = getSnapshot()\n const selected = selector(snapshot)\n\n if (\n selectedSnapshotRef.current === undefined ||\n !isEqual(selectedSnapshotRef.current, selected)\n ) {\n selectedSnapshotRef.current = selected\n }\n\n return selectedSnapshotRef.current\n }\n\n return useSyncExternalStore(subscribe, getSelectedSnapshot)\n}\n"],"mappings":";;AAeA,SAAgB,qBACd,WACA,aACA;CACA,MAAM,QAAQ,YAAY;CAE1B,MAAM,CAAC,EAAE,aAAa,eAAe,SAAmB,EACtD,WAAW;EAAE,QAAQ;EAAO,cAAc;CAAY,EACxD,CAAC;CAED,sBAAsB;EACpB,UAAU,SAAS;EACnB,UAAU,eAAe;EAEzB,IAAI,kBAAkB,SAAS,GAC7B,YAAY,EAAE,UAAU,CAAC;CAE7B,GAAG;EAAC;EAAW;EAAO;CAAW,CAAC;CAElC,gBAAgB;EACd,IAAI,kBAAkB,SAAS,GAC7B,YAAY,EAAE,UAAU,CAAC;EAG3B,OAAO,gBAAgB;GACrB,IAAI,kBAAkB,SAAS,GAC7B,YAAY,EAAE,UAAU,CAAC;EAE7B,CAAC;CACH,GAAG,CAAC,SAAS,CAAC;CAEd,OAAO;AACT;AAEA,SAAS,kBAAkB,MAGf;CACV,MAAM,oBAAoB,KAAK;CAC/B,MAAM,YAAY,KAAK;CACvB,IAAI;EACF,MAAM,YAAY,kBAAkB;EACpC,OAAO,CAAC,OAAO,GAAG,WAAW,SAAS;CAExC,SAAS,QAAQ;EACf,OAAO;CACT;AACF;AAEA,SAAgB,iCACd,WACA,aACA,UACA,SACW;CACX,MAAM,sBAAsB,OAA8B;CAE1D,MAAM,4BAA4B;EAEhC,MAAM,WAAW,SADA,YACgB,CAAC;EAElC,IACE,oBAAoB,YAAY,KAAA,KAChC,CAAC,QAAQ,oBAAoB,SAAS,QAAQ,GAE9C,oBAAoB,UAAU;EAGhC,OAAO,oBAAoB;CAC7B;CAEA,OAAO,qBAAqB,WAAW,mBAAmB;AAC5D"}
1
+ {"version":3,"file":"utils.js","names":[],"sources":["../../src/utils.ts"],"sourcesContent":["import { useEffect, useLayoutEffect, useRef, useState } from 'preact/hooks'\n\n/**\n * This is taken from https://github.com/preactjs/preact/blob/main/compat/src/hooks.js#L8-L54\n * which is taken from https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreShimClient.js#L84\n * on a high level this cuts out the warnings, ... and attempts a smaller implementation.\n * This way we don't have to import preact/compat with side effects\n */\ntype InternalStore = {\n _value: any\n _getSnapshot: () => any\n}\ntype StoreRef = {\n _instance: InternalStore\n}\nexport function useSyncExternalStore(\n subscribe: (onStoreChange: () => void) => () => void,\n getSnapshot: () => any,\n) {\n const value = getSnapshot()\n\n const [{ _instance }, forceUpdate] = useState<StoreRef>({\n _instance: { _value: value, _getSnapshot: getSnapshot },\n })\n\n useLayoutEffect(() => {\n _instance._value = value\n _instance._getSnapshot = getSnapshot\n\n if (didSnapshotChange(_instance)) {\n forceUpdate({ _instance })\n }\n }, [subscribe, value, getSnapshot])\n\n useEffect(() => {\n if (didSnapshotChange(_instance)) {\n forceUpdate({ _instance })\n }\n\n return subscribe(() => {\n if (didSnapshotChange(_instance)) {\n forceUpdate({ _instance })\n }\n })\n }, [subscribe])\n\n return value\n}\n\nfunction didSnapshotChange(inst: {\n _getSnapshot: () => any\n _value: any\n}): boolean {\n const latestGetSnapshot = inst._getSnapshot\n const prevValue = inst._value\n try {\n const nextValue = latestGetSnapshot()\n return !Object.is(prevValue, nextValue)\n } catch (_error) {\n return true\n }\n}\n\nexport function useSyncExternalStoreWithSelector<TSnapshot, TSelected>(\n subscribe: (onStoreChange: () => void) => () => void,\n getSnapshot: () => TSnapshot,\n selector: (snapshot: TSnapshot) => TSelected,\n isEqual: (a: TSelected, b: TSelected) => boolean,\n): TSelected {\n const selectedSnapshotRef = useRef<TSelected | undefined>()\n\n const getSelectedSnapshot = () => {\n const snapshot = getSnapshot()\n const selected = selector(snapshot)\n\n if (\n selectedSnapshotRef.current === undefined ||\n !isEqual(selectedSnapshotRef.current, selected)\n ) {\n selectedSnapshotRef.current = selected\n }\n\n return selectedSnapshotRef.current\n }\n\n return useSyncExternalStore(subscribe, getSelectedSnapshot)\n}\n"],"mappings":";;AAeA,SAAgB,qBACd,WACA,aACA;CACA,MAAM,QAAQ,YAAY;CAE1B,MAAM,CAAC,EAAE,aAAa,eAAe,SAAmB,EACtD,WAAW;EAAE,QAAQ;EAAO,cAAc;CAAY,EACxD,CAAC;CAED,sBAAsB;EACpB,UAAU,SAAS;EACnB,UAAU,eAAe;EAEzB,IAAI,kBAAkB,SAAS,GAC7B,YAAY,EAAE,UAAU,CAAC;CAE7B,GAAG;EAAC;EAAW;EAAO;CAAW,CAAC;CAElC,gBAAgB;EACd,IAAI,kBAAkB,SAAS,GAC7B,YAAY,EAAE,UAAU,CAAC;EAG3B,OAAO,gBAAgB;GACrB,IAAI,kBAAkB,SAAS,GAC7B,YAAY,EAAE,UAAU,CAAC;EAE7B,CAAC;CACH,GAAG,CAAC,SAAS,CAAC;CAEd,OAAO;AACT;AAEA,SAAS,kBAAkB,MAGf;CACV,MAAM,oBAAoB,KAAK;CAC/B,MAAM,YAAY,KAAK;CACvB,IAAI;EACF,MAAM,YAAY,kBAAkB;EACpC,OAAO,CAAC,OAAO,GAAG,WAAW,SAAS;CACxC,SAAS,QAAQ;EACf,OAAO;CACT;AACF;AAEA,SAAgB,iCACd,WACA,aACA,UACA,SACW;CACX,MAAM,sBAAsB,OAA8B;CAE1D,MAAM,4BAA4B;EAEhC,MAAM,WAAW,SADA,YACgB,CAAC;EAElC,IACE,oBAAoB,YAAY,KAAA,KAChC,CAAC,QAAQ,oBAAoB,SAAS,QAAQ,GAE9C,oBAAoB,UAAU;EAGhC,OAAO,oBAAoB;CAC7B;CAEA,OAAO,qBAAqB,WAAW,mBAAmB;AAC5D"}
@@ -1 +1 @@
1
- {"version":3,"file":"HydrationBoundary.cjs","names":["useQueryClient","useRef","useMemo","Fragment"],"sources":["../../src/HydrationBoundary.tsx"],"sourcesContent":["import { hydrate } from '@tanstack/query-core'\nimport type {\n DehydratedState,\n HydrateOptions,\n OmitKeyof,\n QueryClient,\n} from '@tanstack/query-core'\nimport { Fragment } from 'preact'\nimport type { ComponentChildren } from 'preact'\nimport { useEffect, useMemo, useRef } from 'preact/hooks'\n\nimport { useQueryClient } from './QueryClientProvider'\n\nexport interface HydrationBoundaryProps {\n state: DehydratedState | null | undefined\n options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {\n defaultOptions?: OmitKeyof<\n Exclude<HydrateOptions['defaultOptions'], undefined>,\n 'mutations'\n >\n }\n children?: ComponentChildren\n queryClient?: QueryClient\n}\n\nexport const HydrationBoundary = ({\n children,\n options = {},\n state,\n queryClient,\n}: HydrationBoundaryProps) => {\n const client = useQueryClient(queryClient)\n\n const optionsRef = useRef(options)\n useEffect(() => {\n optionsRef.current = options\n })\n\n // This useMemo is for performance reasons only, everything inside it must\n // be safe to run in every render and code here should be read as \"in render\".\n //\n // This code needs to happen during the render phase, because after initial\n // SSR, hydration needs to happen _before_ children render. Also, if hydrating\n // during a transition, we want to hydrate as much as is safe in render so\n // we can prerender as much as possible.\n //\n // For any queries that already exist in the cache, we want to hold back on\n // hydrating until _after_ the render phase. The reason for this is that during\n // transitions, we don't want the existing queries and observers to update to\n // the new data on the current page, only _after_ the transition is committed.\n // If the transition is aborted, we will have hydrated any _new_ queries, but\n // we throw away the fresh data for any existing ones to avoid unexpectedly\n // updating the UI.\n const hydrationQueue: DehydratedState['queries'] | undefined = useMemo(() => {\n if (state) {\n if (typeof state !== 'object') {\n return\n }\n\n const queryCache = client.getQueryCache()\n // State is supplied from the outside and we might as well fail\n // gracefully if it has the wrong shape, so while we type `queries`\n // as required, we still provide a fallback.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const queries = state.queries || []\n\n const newQueries: DehydratedState['queries'] = []\n const existingQueries: DehydratedState['queries'] = []\n for (const dehydratedQuery of queries) {\n const existingQuery = queryCache.get(dehydratedQuery.queryHash)\n\n if (!existingQuery) {\n newQueries.push(dehydratedQuery)\n } else {\n const hydrationIsNewer =\n dehydratedQuery.state.dataUpdatedAt >\n existingQuery.state.dataUpdatedAt ||\n (dehydratedQuery.promise &&\n existingQuery.state.status !== 'pending' &&\n existingQuery.state.fetchStatus !== 'fetching' &&\n dehydratedQuery.dehydratedAt !== undefined &&\n dehydratedQuery.dehydratedAt > existingQuery.state.dataUpdatedAt)\n\n if (hydrationIsNewer) {\n existingQueries.push(dehydratedQuery)\n }\n }\n }\n\n if (newQueries.length > 0) {\n // It's actually fine to call this with queries/state that already exists\n // in the cache, or is older. hydrate() is idempotent for queries.\n hydrate(client, { queries: newQueries }, optionsRef.current)\n }\n if (existingQueries.length > 0) {\n return existingQueries\n }\n }\n return undefined\n }, [client, state])\n\n useEffect(() => {\n if (hydrationQueue) {\n hydrate(client, { queries: hydrationQueue }, optionsRef.current)\n }\n }, [client, hydrationQueue])\n\n return <Fragment>{children}</Fragment>\n}\n"],"mappings":";;;;;;;AAyBA,MAAa,qBAAqB,EAChC,UACA,UAAU,CAAC,GACX,OACA,kBAC4B;CAC5B,MAAM,SAASA,4BAAAA,eAAe,WAAW;CAEzC,MAAM,cAAA,GAAaC,aAAAA,OAAAA,CAAO,OAAO;CACjC,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,WAAW,UAAU;CACvB,CAAC;CAiBD,MAAM,kBAAA,GAAyDC,aAAAA,QAAAA,OAAc;EAC3E,IAAI,OAAO;GACT,IAAI,OAAO,UAAU,UACnB;GAGF,MAAM,aAAa,OAAO,cAAc;GAKxC,MAAM,UAAU,MAAM,WAAW,CAAC;GAElC,MAAM,aAAyC,CAAC;GAChD,MAAM,kBAA8C,CAAC;GACrD,KAAK,MAAM,mBAAmB,SAAS;IACrC,MAAM,gBAAgB,WAAW,IAAI,gBAAgB,SAAS;IAE9D,IAAI,CAAC,eACH,WAAW,KAAK,eAAe;SAW/B,IARE,gBAAgB,MAAM,gBACpB,cAAc,MAAM,iBACrB,gBAAgB,WACf,cAAc,MAAM,WAAW,aAC/B,cAAc,MAAM,gBAAgB,cACpC,gBAAgB,iBAAiB,KAAA,KACjC,gBAAgB,eAAe,cAAc,MAAM,eAGrD,gBAAgB,KAAK,eAAe;GAG1C;GAEA,IAAI,WAAW,SAAS,GAGtB,CAAA,GAAA,qBAAA,QAAA,CAAQ,QAAQ,EAAE,SAAS,WAAW,GAAG,WAAW,OAAO;GAE7D,IAAI,gBAAgB,SAAS,GAC3B,OAAO;EAEX;CAEF,GAAG,CAAC,QAAQ,KAAK,CAAC;CAElB,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,IAAI,gBACF,CAAA,GAAA,qBAAA,QAAA,CAAQ,QAAQ,EAAE,SAAS,eAAe,GAAG,WAAW,OAAO;CAEnE,GAAG,CAAC,QAAQ,cAAc,CAAC;CAE3B,OAAO,iBAAA,GAAA,mBAAA,IAAA,CAACC,OAAAA,UAAD,EAAW,SAAmB,CAAA;AACvC"}
1
+ {"version":3,"file":"HydrationBoundary.cjs","names":["useQueryClient","useRef","useMemo","Fragment"],"sources":["../../src/HydrationBoundary.tsx"],"sourcesContent":["import { hydrate } from '@tanstack/query-core'\nimport type {\n DehydratedState,\n HydrateOptions,\n OmitKeyof,\n QueryClient,\n} from '@tanstack/query-core'\nimport { Fragment } from 'preact'\nimport type { ComponentChildren } from 'preact'\nimport { useEffect, useMemo, useRef } from 'preact/hooks'\n\nimport { useQueryClient } from './QueryClientProvider'\n\nexport interface HydrationBoundaryProps {\n state: DehydratedState | null | undefined\n options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {\n defaultOptions?: OmitKeyof<\n Exclude<HydrateOptions['defaultOptions'], undefined>,\n 'mutations'\n >\n }\n children?: ComponentChildren\n queryClient?: QueryClient\n}\n\nexport const HydrationBoundary = ({\n children,\n options = {},\n state,\n queryClient,\n}: HydrationBoundaryProps) => {\n const client = useQueryClient(queryClient)\n\n const optionsRef = useRef(options)\n useEffect(() => {\n optionsRef.current = options\n })\n\n // This useMemo is for performance reasons only, everything inside it must\n // be safe to run in every render and code here should be read as \"in render\".\n //\n // This code needs to happen during the render phase, because after initial\n // SSR, hydration needs to happen _before_ children render. Also, if hydrating\n // during a transition, we want to hydrate as much as is safe in render so\n // we can prerender as much as possible.\n //\n // For any queries that already exist in the cache, we want to hold back on\n // hydrating until _after_ the render phase. The reason for this is that during\n // transitions, we don't want the existing queries and observers to update to\n // the new data on the current page, only _after_ the transition is committed.\n // If the transition is aborted, we will have hydrated any _new_ queries, but\n // we throw away the fresh data for any existing ones to avoid unexpectedly\n // updating the UI.\n const hydrationQueue: DehydratedState['queries'] | undefined = useMemo(() => {\n if (state) {\n if (typeof state !== 'object') {\n return\n }\n\n const queryCache = client.getQueryCache()\n // State is supplied from the outside and we might as well fail\n // gracefully if it has the wrong shape, so while we type `queries`\n // as required, we still provide a fallback.\n const queries = state.queries || []\n\n const newQueries: DehydratedState['queries'] = []\n const existingQueries: DehydratedState['queries'] = []\n for (const dehydratedQuery of queries) {\n const existingQuery = queryCache.get(dehydratedQuery.queryHash)\n\n if (!existingQuery) {\n newQueries.push(dehydratedQuery)\n } else {\n const hydrationIsNewer =\n dehydratedQuery.state.dataUpdatedAt >\n existingQuery.state.dataUpdatedAt ||\n (dehydratedQuery.promise &&\n existingQuery.state.status !== 'pending' &&\n existingQuery.state.fetchStatus !== 'fetching' &&\n dehydratedQuery.dehydratedAt !== undefined &&\n dehydratedQuery.dehydratedAt > existingQuery.state.dataUpdatedAt)\n\n if (hydrationIsNewer) {\n existingQueries.push(dehydratedQuery)\n }\n }\n }\n\n if (newQueries.length > 0) {\n // It's actually fine to call this with queries/state that already exists\n // in the cache, or is older. hydrate() is idempotent for queries.\n hydrate(client, { queries: newQueries }, optionsRef.current)\n }\n if (existingQueries.length > 0) {\n return existingQueries\n }\n }\n return undefined\n }, [client, state])\n\n useEffect(() => {\n if (hydrationQueue) {\n hydrate(client, { queries: hydrationQueue }, optionsRef.current)\n }\n }, [client, hydrationQueue])\n\n return <Fragment>{children}</Fragment>\n}\n"],"mappings":";;;;;;;AAyBA,MAAa,qBAAqB,EAChC,UACA,UAAU,CAAC,GACX,OACA,kBAC4B;CAC5B,MAAM,SAASA,4BAAAA,eAAe,WAAW;CAEzC,MAAM,cAAA,GAAaC,aAAAA,OAAAA,CAAO,OAAO;CACjC,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,WAAW,UAAU;CACvB,CAAC;CAiBD,MAAM,kBAAA,GAAyDC,aAAAA,QAAAA,OAAc;EAC3E,IAAI,OAAO;GACT,IAAI,OAAO,UAAU,UACnB;GAGF,MAAM,aAAa,OAAO,cAAc;GAIxC,MAAM,UAAU,MAAM,WAAW,CAAC;GAElC,MAAM,aAAyC,CAAC;GAChD,MAAM,kBAA8C,CAAC;GACrD,KAAK,MAAM,mBAAmB,SAAS;IACrC,MAAM,gBAAgB,WAAW,IAAI,gBAAgB,SAAS;IAE9D,IAAI,CAAC,eACH,WAAW,KAAK,eAAe;SAW/B,IARE,gBAAgB,MAAM,gBACpB,cAAc,MAAM,iBACrB,gBAAgB,WACf,cAAc,MAAM,WAAW,aAC/B,cAAc,MAAM,gBAAgB,cACpC,gBAAgB,iBAAiB,KAAA,KACjC,gBAAgB,eAAe,cAAc,MAAM,eAGrD,gBAAgB,KAAK,eAAe;GAG1C;GAEA,IAAI,WAAW,SAAS,GAGtB,CAAA,GAAA,qBAAA,QAAA,CAAQ,QAAQ,EAAE,SAAS,WAAW,GAAG,WAAW,OAAO;GAE7D,IAAI,gBAAgB,SAAS,GAC3B,OAAO;EAEX;CAEF,GAAG,CAAC,QAAQ,KAAK,CAAC;CAElB,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,IAAI,gBACF,CAAA,GAAA,qBAAA,QAAA,CAAQ,QAAQ,EAAE,SAAS,eAAe,GAAG,WAAW,OAAO;CAEnE,GAAG,CAAC,QAAQ,cAAc,CAAC;CAE3B,OAAO,iBAAA,GAAA,mBAAA,IAAA,CAACC,OAAAA,UAAD,EAAW,SAAmB,CAAA;AACvC"}
@@ -1 +1 @@
1
- {"version":3,"file":"HydrationBoundary.js","names":[],"sources":["../../src/HydrationBoundary.tsx"],"sourcesContent":["import { hydrate } from '@tanstack/query-core'\nimport type {\n DehydratedState,\n HydrateOptions,\n OmitKeyof,\n QueryClient,\n} from '@tanstack/query-core'\nimport { Fragment } from 'preact'\nimport type { ComponentChildren } from 'preact'\nimport { useEffect, useMemo, useRef } from 'preact/hooks'\n\nimport { useQueryClient } from './QueryClientProvider'\n\nexport interface HydrationBoundaryProps {\n state: DehydratedState | null | undefined\n options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {\n defaultOptions?: OmitKeyof<\n Exclude<HydrateOptions['defaultOptions'], undefined>,\n 'mutations'\n >\n }\n children?: ComponentChildren\n queryClient?: QueryClient\n}\n\nexport const HydrationBoundary = ({\n children,\n options = {},\n state,\n queryClient,\n}: HydrationBoundaryProps) => {\n const client = useQueryClient(queryClient)\n\n const optionsRef = useRef(options)\n useEffect(() => {\n optionsRef.current = options\n })\n\n // This useMemo is for performance reasons only, everything inside it must\n // be safe to run in every render and code here should be read as \"in render\".\n //\n // This code needs to happen during the render phase, because after initial\n // SSR, hydration needs to happen _before_ children render. Also, if hydrating\n // during a transition, we want to hydrate as much as is safe in render so\n // we can prerender as much as possible.\n //\n // For any queries that already exist in the cache, we want to hold back on\n // hydrating until _after_ the render phase. The reason for this is that during\n // transitions, we don't want the existing queries and observers to update to\n // the new data on the current page, only _after_ the transition is committed.\n // If the transition is aborted, we will have hydrated any _new_ queries, but\n // we throw away the fresh data for any existing ones to avoid unexpectedly\n // updating the UI.\n const hydrationQueue: DehydratedState['queries'] | undefined = useMemo(() => {\n if (state) {\n if (typeof state !== 'object') {\n return\n }\n\n const queryCache = client.getQueryCache()\n // State is supplied from the outside and we might as well fail\n // gracefully if it has the wrong shape, so while we type `queries`\n // as required, we still provide a fallback.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const queries = state.queries || []\n\n const newQueries: DehydratedState['queries'] = []\n const existingQueries: DehydratedState['queries'] = []\n for (const dehydratedQuery of queries) {\n const existingQuery = queryCache.get(dehydratedQuery.queryHash)\n\n if (!existingQuery) {\n newQueries.push(dehydratedQuery)\n } else {\n const hydrationIsNewer =\n dehydratedQuery.state.dataUpdatedAt >\n existingQuery.state.dataUpdatedAt ||\n (dehydratedQuery.promise &&\n existingQuery.state.status !== 'pending' &&\n existingQuery.state.fetchStatus !== 'fetching' &&\n dehydratedQuery.dehydratedAt !== undefined &&\n dehydratedQuery.dehydratedAt > existingQuery.state.dataUpdatedAt)\n\n if (hydrationIsNewer) {\n existingQueries.push(dehydratedQuery)\n }\n }\n }\n\n if (newQueries.length > 0) {\n // It's actually fine to call this with queries/state that already exists\n // in the cache, or is older. hydrate() is idempotent for queries.\n hydrate(client, { queries: newQueries }, optionsRef.current)\n }\n if (existingQueries.length > 0) {\n return existingQueries\n }\n }\n return undefined\n }, [client, state])\n\n useEffect(() => {\n if (hydrationQueue) {\n hydrate(client, { queries: hydrationQueue }, optionsRef.current)\n }\n }, [client, hydrationQueue])\n\n return <Fragment>{children}</Fragment>\n}\n"],"mappings":";;;;;;AAyBA,MAAa,qBAAqB,EAChC,UACA,UAAU,CAAC,GACX,OACA,kBAC4B;CAC5B,MAAM,SAAS,eAAe,WAAW;CAEzC,MAAM,aAAa,OAAO,OAAO;CACjC,gBAAgB;EACd,WAAW,UAAU;CACvB,CAAC;CAiBD,MAAM,iBAAyD,cAAc;EAC3E,IAAI,OAAO;GACT,IAAI,OAAO,UAAU,UACnB;GAGF,MAAM,aAAa,OAAO,cAAc;GAKxC,MAAM,UAAU,MAAM,WAAW,CAAC;GAElC,MAAM,aAAyC,CAAC;GAChD,MAAM,kBAA8C,CAAC;GACrD,KAAK,MAAM,mBAAmB,SAAS;IACrC,MAAM,gBAAgB,WAAW,IAAI,gBAAgB,SAAS;IAE9D,IAAI,CAAC,eACH,WAAW,KAAK,eAAe;SAW/B,IARE,gBAAgB,MAAM,gBACpB,cAAc,MAAM,iBACrB,gBAAgB,WACf,cAAc,MAAM,WAAW,aAC/B,cAAc,MAAM,gBAAgB,cACpC,gBAAgB,iBAAiB,KAAA,KACjC,gBAAgB,eAAe,cAAc,MAAM,eAGrD,gBAAgB,KAAK,eAAe;GAG1C;GAEA,IAAI,WAAW,SAAS,GAGtB,QAAQ,QAAQ,EAAE,SAAS,WAAW,GAAG,WAAW,OAAO;GAE7D,IAAI,gBAAgB,SAAS,GAC3B,OAAO;EAEX;CAEF,GAAG,CAAC,QAAQ,KAAK,CAAC;CAElB,gBAAgB;EACd,IAAI,gBACF,QAAQ,QAAQ,EAAE,SAAS,eAAe,GAAG,WAAW,OAAO;CAEnE,GAAG,CAAC,QAAQ,cAAc,CAAC;CAE3B,OAAO,oBAAC,UAAD,EAAW,SAAmB,CAAA;AACvC"}
1
+ {"version":3,"file":"HydrationBoundary.js","names":[],"sources":["../../src/HydrationBoundary.tsx"],"sourcesContent":["import { hydrate } from '@tanstack/query-core'\nimport type {\n DehydratedState,\n HydrateOptions,\n OmitKeyof,\n QueryClient,\n} from '@tanstack/query-core'\nimport { Fragment } from 'preact'\nimport type { ComponentChildren } from 'preact'\nimport { useEffect, useMemo, useRef } from 'preact/hooks'\n\nimport { useQueryClient } from './QueryClientProvider'\n\nexport interface HydrationBoundaryProps {\n state: DehydratedState | null | undefined\n options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {\n defaultOptions?: OmitKeyof<\n Exclude<HydrateOptions['defaultOptions'], undefined>,\n 'mutations'\n >\n }\n children?: ComponentChildren\n queryClient?: QueryClient\n}\n\nexport const HydrationBoundary = ({\n children,\n options = {},\n state,\n queryClient,\n}: HydrationBoundaryProps) => {\n const client = useQueryClient(queryClient)\n\n const optionsRef = useRef(options)\n useEffect(() => {\n optionsRef.current = options\n })\n\n // This useMemo is for performance reasons only, everything inside it must\n // be safe to run in every render and code here should be read as \"in render\".\n //\n // This code needs to happen during the render phase, because after initial\n // SSR, hydration needs to happen _before_ children render. Also, if hydrating\n // during a transition, we want to hydrate as much as is safe in render so\n // we can prerender as much as possible.\n //\n // For any queries that already exist in the cache, we want to hold back on\n // hydrating until _after_ the render phase. The reason for this is that during\n // transitions, we don't want the existing queries and observers to update to\n // the new data on the current page, only _after_ the transition is committed.\n // If the transition is aborted, we will have hydrated any _new_ queries, but\n // we throw away the fresh data for any existing ones to avoid unexpectedly\n // updating the UI.\n const hydrationQueue: DehydratedState['queries'] | undefined = useMemo(() => {\n if (state) {\n if (typeof state !== 'object') {\n return\n }\n\n const queryCache = client.getQueryCache()\n // State is supplied from the outside and we might as well fail\n // gracefully if it has the wrong shape, so while we type `queries`\n // as required, we still provide a fallback.\n const queries = state.queries || []\n\n const newQueries: DehydratedState['queries'] = []\n const existingQueries: DehydratedState['queries'] = []\n for (const dehydratedQuery of queries) {\n const existingQuery = queryCache.get(dehydratedQuery.queryHash)\n\n if (!existingQuery) {\n newQueries.push(dehydratedQuery)\n } else {\n const hydrationIsNewer =\n dehydratedQuery.state.dataUpdatedAt >\n existingQuery.state.dataUpdatedAt ||\n (dehydratedQuery.promise &&\n existingQuery.state.status !== 'pending' &&\n existingQuery.state.fetchStatus !== 'fetching' &&\n dehydratedQuery.dehydratedAt !== undefined &&\n dehydratedQuery.dehydratedAt > existingQuery.state.dataUpdatedAt)\n\n if (hydrationIsNewer) {\n existingQueries.push(dehydratedQuery)\n }\n }\n }\n\n if (newQueries.length > 0) {\n // It's actually fine to call this with queries/state that already exists\n // in the cache, or is older. hydrate() is idempotent for queries.\n hydrate(client, { queries: newQueries }, optionsRef.current)\n }\n if (existingQueries.length > 0) {\n return existingQueries\n }\n }\n return undefined\n }, [client, state])\n\n useEffect(() => {\n if (hydrationQueue) {\n hydrate(client, { queries: hydrationQueue }, optionsRef.current)\n }\n }, [client, hydrationQueue])\n\n return <Fragment>{children}</Fragment>\n}\n"],"mappings":";;;;;;AAyBA,MAAa,qBAAqB,EAChC,UACA,UAAU,CAAC,GACX,OACA,kBAC4B;CAC5B,MAAM,SAAS,eAAe,WAAW;CAEzC,MAAM,aAAa,OAAO,OAAO;CACjC,gBAAgB;EACd,WAAW,UAAU;CACvB,CAAC;CAiBD,MAAM,iBAAyD,cAAc;EAC3E,IAAI,OAAO;GACT,IAAI,OAAO,UAAU,UACnB;GAGF,MAAM,aAAa,OAAO,cAAc;GAIxC,MAAM,UAAU,MAAM,WAAW,CAAC;GAElC,MAAM,aAAyC,CAAC;GAChD,MAAM,kBAA8C,CAAC;GACrD,KAAK,MAAM,mBAAmB,SAAS;IACrC,MAAM,gBAAgB,WAAW,IAAI,gBAAgB,SAAS;IAE9D,IAAI,CAAC,eACH,WAAW,KAAK,eAAe;SAW/B,IARE,gBAAgB,MAAM,gBACpB,cAAc,MAAM,iBACrB,gBAAgB,WACf,cAAc,MAAM,WAAW,aAC/B,cAAc,MAAM,gBAAgB,cACpC,gBAAgB,iBAAiB,KAAA,KACjC,gBAAgB,eAAe,cAAc,MAAM,eAGrD,gBAAgB,KAAK,eAAe;GAG1C;GAEA,IAAI,WAAW,SAAS,GAGtB,QAAQ,QAAQ,EAAE,SAAS,WAAW,GAAG,WAAW,OAAO;GAE7D,IAAI,gBAAgB,SAAS,GAC3B,OAAO;EAEX;CAEF,GAAG,CAAC,QAAQ,KAAK,CAAC;CAElB,gBAAgB;EACd,IAAI,gBACF,QAAQ,QAAQ,EAAE,SAAS,eAAe,GAAG,WAAW,OAAO;CAEnE,GAAG,CAAC,QAAQ,cAAc,CAAC;CAE3B,OAAO,oBAAC,UAAD,EAAW,SAAmB,CAAA;AACvC"}
@@ -4,7 +4,7 @@ let _tanstack_query_core = require("@tanstack/query-core");
4
4
  //#region src/usePrefetchQuery.tsx
5
5
  function usePrefetchQuery(options, queryClient) {
6
6
  const client = require_QueryClientProvider.useQueryClient(queryClient);
7
- if (!client.getQueryState(options.queryKey)) client.fetchQuery(options).catch(_tanstack_query_core.noop);
7
+ if (!client.getQueryState(options.queryKey)) client.query(options).catch(_tanstack_query_core.noop);
8
8
  }
9
9
  //#endregion
10
10
  exports.usePrefetchQuery = usePrefetchQuery;
@@ -1 +1 @@
1
- {"version":3,"file":"usePrefetchQuery.cjs","names":["useQueryClient","noop"],"sources":["../../src/usePrefetchQuery.tsx"],"sourcesContent":["import { noop } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\n\nimport type { DefaultError, QueryClient, QueryKey } from '@tanstack/query-core'\nimport type { UsePrefetchQueryOptions } from './types'\n\nexport function usePrefetchQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UsePrefetchQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n queryClient?: QueryClient,\n) {\n const client = useQueryClient(queryClient)\n\n if (!client.getQueryState(options.queryKey)) {\n void client.fetchQuery(options).catch(noop)\n }\n}\n"],"mappings":";;;;AAMA,SAAgB,iBAOd,SAOA,aACA;CACA,MAAM,SAASA,4BAAAA,eAAe,WAAW;CAEzC,IAAI,CAAC,OAAO,cAAc,QAAQ,QAAQ,GACxC,OAAY,WAAW,OAAO,CAAC,CAAC,MAAMC,qBAAAA,IAAI;AAE9C"}
1
+ {"version":3,"file":"usePrefetchQuery.cjs","names":["useQueryClient","noop"],"sources":["../../src/usePrefetchQuery.tsx"],"sourcesContent":["import { noop } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\n\nimport type { DefaultError, QueryClient, QueryKey } from '@tanstack/query-core'\nimport type { UsePrefetchQueryOptions } from './types'\n\nexport function usePrefetchQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UsePrefetchQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n queryClient?: QueryClient,\n) {\n const client = useQueryClient(queryClient)\n\n if (!client.getQueryState(options.queryKey)) {\n void client.query(options).catch(noop)\n }\n}\n"],"mappings":";;;;AAMA,SAAgB,iBAOd,SAOA,aACA;CACA,MAAM,SAASA,4BAAAA,eAAe,WAAW;CAEzC,IAAI,CAAC,OAAO,cAAc,QAAQ,QAAQ,GACxC,OAAY,MAAM,OAAO,CAAC,CAAC,MAAMC,qBAAAA,IAAI;AAEzC"}
@@ -3,7 +3,7 @@ import { noop } from "@tanstack/query-core";
3
3
  //#region src/usePrefetchQuery.tsx
4
4
  function usePrefetchQuery(options, queryClient) {
5
5
  const client = useQueryClient(queryClient);
6
- if (!client.getQueryState(options.queryKey)) client.fetchQuery(options).catch(noop);
6
+ if (!client.getQueryState(options.queryKey)) client.query(options).catch(noop);
7
7
  }
8
8
  //#endregion
9
9
  export { usePrefetchQuery };
@@ -1 +1 @@
1
- {"version":3,"file":"usePrefetchQuery.js","names":[],"sources":["../../src/usePrefetchQuery.tsx"],"sourcesContent":["import { noop } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\n\nimport type { DefaultError, QueryClient, QueryKey } from '@tanstack/query-core'\nimport type { UsePrefetchQueryOptions } from './types'\n\nexport function usePrefetchQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UsePrefetchQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n queryClient?: QueryClient,\n) {\n const client = useQueryClient(queryClient)\n\n if (!client.getQueryState(options.queryKey)) {\n void client.fetchQuery(options).catch(noop)\n }\n}\n"],"mappings":";;;AAMA,SAAgB,iBAOd,SAOA,aACA;CACA,MAAM,SAAS,eAAe,WAAW;CAEzC,IAAI,CAAC,OAAO,cAAc,QAAQ,QAAQ,GACxC,OAAY,WAAW,OAAO,CAAC,CAAC,MAAM,IAAI;AAE9C"}
1
+ {"version":3,"file":"usePrefetchQuery.js","names":[],"sources":["../../src/usePrefetchQuery.tsx"],"sourcesContent":["import { noop } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\n\nimport type { DefaultError, QueryClient, QueryKey } from '@tanstack/query-core'\nimport type { UsePrefetchQueryOptions } from './types'\n\nexport function usePrefetchQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UsePrefetchQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n queryClient?: QueryClient,\n) {\n const client = useQueryClient(queryClient)\n\n if (!client.getQueryState(options.queryKey)) {\n void client.query(options).catch(noop)\n }\n}\n"],"mappings":";;;AAMA,SAAgB,iBAOd,SAOA,aACA;CACA,MAAM,SAAS,eAAe,WAAW;CAEzC,IAAI,CAAC,OAAO,cAAc,QAAQ,QAAQ,GACxC,OAAY,MAAM,OAAO,CAAC,CAAC,MAAM,IAAI;AAEzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.cjs","names":["useState","useRef"],"sources":["../../src/utils.ts"],"sourcesContent":["import { useEffect, useLayoutEffect, useRef, useState } from 'preact/hooks'\n\n/**\n * This is taken from https://github.com/preactjs/preact/blob/main/compat/src/hooks.js#L8-L54\n * which is taken from https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreShimClient.js#L84\n * on a high level this cuts out the warnings, ... and attempts a smaller implementation.\n * This way we don't have to import preact/compat with side effects\n */\ntype InternalStore = {\n _value: any\n _getSnapshot: () => any\n}\ntype StoreRef = {\n _instance: InternalStore\n}\nexport function useSyncExternalStore(\n subscribe: (onStoreChange: () => void) => () => void,\n getSnapshot: () => any,\n) {\n const value = getSnapshot()\n\n const [{ _instance }, forceUpdate] = useState<StoreRef>({\n _instance: { _value: value, _getSnapshot: getSnapshot },\n })\n\n useLayoutEffect(() => {\n _instance._value = value\n _instance._getSnapshot = getSnapshot\n\n if (didSnapshotChange(_instance)) {\n forceUpdate({ _instance })\n }\n }, [subscribe, value, getSnapshot])\n\n useEffect(() => {\n if (didSnapshotChange(_instance)) {\n forceUpdate({ _instance })\n }\n\n return subscribe(() => {\n if (didSnapshotChange(_instance)) {\n forceUpdate({ _instance })\n }\n })\n }, [subscribe])\n\n return value\n}\n\nfunction didSnapshotChange(inst: {\n _getSnapshot: () => any\n _value: any\n}): boolean {\n const latestGetSnapshot = inst._getSnapshot\n const prevValue = inst._value\n try {\n const nextValue = latestGetSnapshot()\n return !Object.is(prevValue, nextValue)\n // eslint-disable-next-line no-unused-vars\n } catch (_error) {\n return true\n }\n}\n\nexport function useSyncExternalStoreWithSelector<TSnapshot, TSelected>(\n subscribe: (onStoreChange: () => void) => () => void,\n getSnapshot: () => TSnapshot,\n selector: (snapshot: TSnapshot) => TSelected,\n isEqual: (a: TSelected, b: TSelected) => boolean,\n): TSelected {\n const selectedSnapshotRef = useRef<TSelected | undefined>()\n\n const getSelectedSnapshot = () => {\n const snapshot = getSnapshot()\n const selected = selector(snapshot)\n\n if (\n selectedSnapshotRef.current === undefined ||\n !isEqual(selectedSnapshotRef.current, selected)\n ) {\n selectedSnapshotRef.current = selected\n }\n\n return selectedSnapshotRef.current\n }\n\n return useSyncExternalStore(subscribe, getSelectedSnapshot)\n}\n"],"mappings":";;;AAeA,SAAgB,qBACd,WACA,aACA;CACA,MAAM,QAAQ,YAAY;CAE1B,MAAM,CAAC,EAAE,aAAa,gBAAA,GAAeA,aAAAA,SAAAA,CAAmB,EACtD,WAAW;EAAE,QAAQ;EAAO,cAAc;CAAY,EACxD,CAAC;CAED,CAAA,GAAA,aAAA,gBAAA,OAAsB;EACpB,UAAU,SAAS;EACnB,UAAU,eAAe;EAEzB,IAAI,kBAAkB,SAAS,GAC7B,YAAY,EAAE,UAAU,CAAC;CAE7B,GAAG;EAAC;EAAW;EAAO;CAAW,CAAC;CAElC,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,IAAI,kBAAkB,SAAS,GAC7B,YAAY,EAAE,UAAU,CAAC;EAG3B,OAAO,gBAAgB;GACrB,IAAI,kBAAkB,SAAS,GAC7B,YAAY,EAAE,UAAU,CAAC;EAE7B,CAAC;CACH,GAAG,CAAC,SAAS,CAAC;CAEd,OAAO;AACT;AAEA,SAAS,kBAAkB,MAGf;CACV,MAAM,oBAAoB,KAAK;CAC/B,MAAM,YAAY,KAAK;CACvB,IAAI;EACF,MAAM,YAAY,kBAAkB;EACpC,OAAO,CAAC,OAAO,GAAG,WAAW,SAAS;CAExC,SAAS,QAAQ;EACf,OAAO;CACT;AACF;AAEA,SAAgB,iCACd,WACA,aACA,UACA,SACW;CACX,MAAM,uBAAA,GAAsBC,aAAAA,OAAAA,CAA8B;CAE1D,MAAM,4BAA4B;EAEhC,MAAM,WAAW,SADA,YACgB,CAAC;EAElC,IACE,oBAAoB,YAAY,KAAA,KAChC,CAAC,QAAQ,oBAAoB,SAAS,QAAQ,GAE9C,oBAAoB,UAAU;EAGhC,OAAO,oBAAoB;CAC7B;CAEA,OAAO,qBAAqB,WAAW,mBAAmB;AAC5D"}
1
+ {"version":3,"file":"utils.cjs","names":["useState","useRef"],"sources":["../../src/utils.ts"],"sourcesContent":["import { useEffect, useLayoutEffect, useRef, useState } from 'preact/hooks'\n\n/**\n * This is taken from https://github.com/preactjs/preact/blob/main/compat/src/hooks.js#L8-L54\n * which is taken from https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreShimClient.js#L84\n * on a high level this cuts out the warnings, ... and attempts a smaller implementation.\n * This way we don't have to import preact/compat with side effects\n */\ntype InternalStore = {\n _value: any\n _getSnapshot: () => any\n}\ntype StoreRef = {\n _instance: InternalStore\n}\nexport function useSyncExternalStore(\n subscribe: (onStoreChange: () => void) => () => void,\n getSnapshot: () => any,\n) {\n const value = getSnapshot()\n\n const [{ _instance }, forceUpdate] = useState<StoreRef>({\n _instance: { _value: value, _getSnapshot: getSnapshot },\n })\n\n useLayoutEffect(() => {\n _instance._value = value\n _instance._getSnapshot = getSnapshot\n\n if (didSnapshotChange(_instance)) {\n forceUpdate({ _instance })\n }\n }, [subscribe, value, getSnapshot])\n\n useEffect(() => {\n if (didSnapshotChange(_instance)) {\n forceUpdate({ _instance })\n }\n\n return subscribe(() => {\n if (didSnapshotChange(_instance)) {\n forceUpdate({ _instance })\n }\n })\n }, [subscribe])\n\n return value\n}\n\nfunction didSnapshotChange(inst: {\n _getSnapshot: () => any\n _value: any\n}): boolean {\n const latestGetSnapshot = inst._getSnapshot\n const prevValue = inst._value\n try {\n const nextValue = latestGetSnapshot()\n return !Object.is(prevValue, nextValue)\n } catch (_error) {\n return true\n }\n}\n\nexport function useSyncExternalStoreWithSelector<TSnapshot, TSelected>(\n subscribe: (onStoreChange: () => void) => () => void,\n getSnapshot: () => TSnapshot,\n selector: (snapshot: TSnapshot) => TSelected,\n isEqual: (a: TSelected, b: TSelected) => boolean,\n): TSelected {\n const selectedSnapshotRef = useRef<TSelected | undefined>()\n\n const getSelectedSnapshot = () => {\n const snapshot = getSnapshot()\n const selected = selector(snapshot)\n\n if (\n selectedSnapshotRef.current === undefined ||\n !isEqual(selectedSnapshotRef.current, selected)\n ) {\n selectedSnapshotRef.current = selected\n }\n\n return selectedSnapshotRef.current\n }\n\n return useSyncExternalStore(subscribe, getSelectedSnapshot)\n}\n"],"mappings":";;;AAeA,SAAgB,qBACd,WACA,aACA;CACA,MAAM,QAAQ,YAAY;CAE1B,MAAM,CAAC,EAAE,aAAa,gBAAA,GAAeA,aAAAA,SAAAA,CAAmB,EACtD,WAAW;EAAE,QAAQ;EAAO,cAAc;CAAY,EACxD,CAAC;CAED,CAAA,GAAA,aAAA,gBAAA,OAAsB;EACpB,UAAU,SAAS;EACnB,UAAU,eAAe;EAEzB,IAAI,kBAAkB,SAAS,GAC7B,YAAY,EAAE,UAAU,CAAC;CAE7B,GAAG;EAAC;EAAW;EAAO;CAAW,CAAC;CAElC,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,IAAI,kBAAkB,SAAS,GAC7B,YAAY,EAAE,UAAU,CAAC;EAG3B,OAAO,gBAAgB;GACrB,IAAI,kBAAkB,SAAS,GAC7B,YAAY,EAAE,UAAU,CAAC;EAE7B,CAAC;CACH,GAAG,CAAC,SAAS,CAAC;CAEd,OAAO;AACT;AAEA,SAAS,kBAAkB,MAGf;CACV,MAAM,oBAAoB,KAAK;CAC/B,MAAM,YAAY,KAAK;CACvB,IAAI;EACF,MAAM,YAAY,kBAAkB;EACpC,OAAO,CAAC,OAAO,GAAG,WAAW,SAAS;CACxC,SAAS,QAAQ;EACf,OAAO;CACT;AACF;AAEA,SAAgB,iCACd,WACA,aACA,UACA,SACW;CACX,MAAM,uBAAA,GAAsBC,aAAAA,OAAAA,CAA8B;CAE1D,MAAM,4BAA4B;EAEhC,MAAM,WAAW,SADA,YACgB,CAAC;EAElC,IACE,oBAAoB,YAAY,KAAA,KAChC,CAAC,QAAQ,oBAAoB,SAAS,QAAQ,GAE9C,oBAAoB,UAAU;EAGhC,OAAO,oBAAoB;CAC7B;CAEA,OAAO,qBAAqB,WAAW,mBAAmB;AAC5D"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.cts","names":[],"sources":["../../src/utils.ts"],"mappings":";iBAegB,qBACd,YAAY,0CACZ;iBA+Cc,iCAAiC,WAAW,WAC1D,YAAY,0CACZ,mBAAmB,WACnB,WAAW,UAAU,cAAc,WACnC,UAAU,GAAG,WAAW,GAAG,wBAC1B"}
1
+ {"version":3,"file":"utils.d.cts","names":[],"sources":["../../src/utils.ts"],"mappings":";iBAegB,qBACd,YAAY,0CACZ;iBA8Cc,iCAAiC,WAAW,WAC1D,YAAY,0CACZ,mBAAmB,WACnB,WAAW,UAAU,cAAc,WACnC,UAAU,GAAG,WAAW,GAAG,wBAC1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/utils.ts"],"mappings":";iBAegB,qBACd,YAAY,0CACZ;iBA+Cc,iCAAiC,WAAW,WAC1D,YAAY,0CACZ,mBAAmB,WACnB,WAAW,UAAU,cAAc,WACnC,UAAU,GAAG,WAAW,GAAG,wBAC1B"}
1
+ {"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/utils.ts"],"mappings":";iBAegB,qBACd,YAAY,0CACZ;iBA8Cc,iCAAiC,WAAW,WAC1D,YAAY,0CACZ,mBAAmB,WACnB,WAAW,UAAU,cAAc,WACnC,UAAU,GAAG,WAAW,GAAG,wBAC1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":[],"sources":["../../src/utils.ts"],"sourcesContent":["import { useEffect, useLayoutEffect, useRef, useState } from 'preact/hooks'\n\n/**\n * This is taken from https://github.com/preactjs/preact/blob/main/compat/src/hooks.js#L8-L54\n * which is taken from https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreShimClient.js#L84\n * on a high level this cuts out the warnings, ... and attempts a smaller implementation.\n * This way we don't have to import preact/compat with side effects\n */\ntype InternalStore = {\n _value: any\n _getSnapshot: () => any\n}\ntype StoreRef = {\n _instance: InternalStore\n}\nexport function useSyncExternalStore(\n subscribe: (onStoreChange: () => void) => () => void,\n getSnapshot: () => any,\n) {\n const value = getSnapshot()\n\n const [{ _instance }, forceUpdate] = useState<StoreRef>({\n _instance: { _value: value, _getSnapshot: getSnapshot },\n })\n\n useLayoutEffect(() => {\n _instance._value = value\n _instance._getSnapshot = getSnapshot\n\n if (didSnapshotChange(_instance)) {\n forceUpdate({ _instance })\n }\n }, [subscribe, value, getSnapshot])\n\n useEffect(() => {\n if (didSnapshotChange(_instance)) {\n forceUpdate({ _instance })\n }\n\n return subscribe(() => {\n if (didSnapshotChange(_instance)) {\n forceUpdate({ _instance })\n }\n })\n }, [subscribe])\n\n return value\n}\n\nfunction didSnapshotChange(inst: {\n _getSnapshot: () => any\n _value: any\n}): boolean {\n const latestGetSnapshot = inst._getSnapshot\n const prevValue = inst._value\n try {\n const nextValue = latestGetSnapshot()\n return !Object.is(prevValue, nextValue)\n // eslint-disable-next-line no-unused-vars\n } catch (_error) {\n return true\n }\n}\n\nexport function useSyncExternalStoreWithSelector<TSnapshot, TSelected>(\n subscribe: (onStoreChange: () => void) => () => void,\n getSnapshot: () => TSnapshot,\n selector: (snapshot: TSnapshot) => TSelected,\n isEqual: (a: TSelected, b: TSelected) => boolean,\n): TSelected {\n const selectedSnapshotRef = useRef<TSelected | undefined>()\n\n const getSelectedSnapshot = () => {\n const snapshot = getSnapshot()\n const selected = selector(snapshot)\n\n if (\n selectedSnapshotRef.current === undefined ||\n !isEqual(selectedSnapshotRef.current, selected)\n ) {\n selectedSnapshotRef.current = selected\n }\n\n return selectedSnapshotRef.current\n }\n\n return useSyncExternalStore(subscribe, getSelectedSnapshot)\n}\n"],"mappings":";;AAeA,SAAgB,qBACd,WACA,aACA;CACA,MAAM,QAAQ,YAAY;CAE1B,MAAM,CAAC,EAAE,aAAa,eAAe,SAAmB,EACtD,WAAW;EAAE,QAAQ;EAAO,cAAc;CAAY,EACxD,CAAC;CAED,sBAAsB;EACpB,UAAU,SAAS;EACnB,UAAU,eAAe;EAEzB,IAAI,kBAAkB,SAAS,GAC7B,YAAY,EAAE,UAAU,CAAC;CAE7B,GAAG;EAAC;EAAW;EAAO;CAAW,CAAC;CAElC,gBAAgB;EACd,IAAI,kBAAkB,SAAS,GAC7B,YAAY,EAAE,UAAU,CAAC;EAG3B,OAAO,gBAAgB;GACrB,IAAI,kBAAkB,SAAS,GAC7B,YAAY,EAAE,UAAU,CAAC;EAE7B,CAAC;CACH,GAAG,CAAC,SAAS,CAAC;CAEd,OAAO;AACT;AAEA,SAAS,kBAAkB,MAGf;CACV,MAAM,oBAAoB,KAAK;CAC/B,MAAM,YAAY,KAAK;CACvB,IAAI;EACF,MAAM,YAAY,kBAAkB;EACpC,OAAO,CAAC,OAAO,GAAG,WAAW,SAAS;CAExC,SAAS,QAAQ;EACf,OAAO;CACT;AACF;AAEA,SAAgB,iCACd,WACA,aACA,UACA,SACW;CACX,MAAM,sBAAsB,OAA8B;CAE1D,MAAM,4BAA4B;EAEhC,MAAM,WAAW,SADA,YACgB,CAAC;EAElC,IACE,oBAAoB,YAAY,KAAA,KAChC,CAAC,QAAQ,oBAAoB,SAAS,QAAQ,GAE9C,oBAAoB,UAAU;EAGhC,OAAO,oBAAoB;CAC7B;CAEA,OAAO,qBAAqB,WAAW,mBAAmB;AAC5D"}
1
+ {"version":3,"file":"utils.js","names":[],"sources":["../../src/utils.ts"],"sourcesContent":["import { useEffect, useLayoutEffect, useRef, useState } from 'preact/hooks'\n\n/**\n * This is taken from https://github.com/preactjs/preact/blob/main/compat/src/hooks.js#L8-L54\n * which is taken from https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreShimClient.js#L84\n * on a high level this cuts out the warnings, ... and attempts a smaller implementation.\n * This way we don't have to import preact/compat with side effects\n */\ntype InternalStore = {\n _value: any\n _getSnapshot: () => any\n}\ntype StoreRef = {\n _instance: InternalStore\n}\nexport function useSyncExternalStore(\n subscribe: (onStoreChange: () => void) => () => void,\n getSnapshot: () => any,\n) {\n const value = getSnapshot()\n\n const [{ _instance }, forceUpdate] = useState<StoreRef>({\n _instance: { _value: value, _getSnapshot: getSnapshot },\n })\n\n useLayoutEffect(() => {\n _instance._value = value\n _instance._getSnapshot = getSnapshot\n\n if (didSnapshotChange(_instance)) {\n forceUpdate({ _instance })\n }\n }, [subscribe, value, getSnapshot])\n\n useEffect(() => {\n if (didSnapshotChange(_instance)) {\n forceUpdate({ _instance })\n }\n\n return subscribe(() => {\n if (didSnapshotChange(_instance)) {\n forceUpdate({ _instance })\n }\n })\n }, [subscribe])\n\n return value\n}\n\nfunction didSnapshotChange(inst: {\n _getSnapshot: () => any\n _value: any\n}): boolean {\n const latestGetSnapshot = inst._getSnapshot\n const prevValue = inst._value\n try {\n const nextValue = latestGetSnapshot()\n return !Object.is(prevValue, nextValue)\n } catch (_error) {\n return true\n }\n}\n\nexport function useSyncExternalStoreWithSelector<TSnapshot, TSelected>(\n subscribe: (onStoreChange: () => void) => () => void,\n getSnapshot: () => TSnapshot,\n selector: (snapshot: TSnapshot) => TSelected,\n isEqual: (a: TSelected, b: TSelected) => boolean,\n): TSelected {\n const selectedSnapshotRef = useRef<TSelected | undefined>()\n\n const getSelectedSnapshot = () => {\n const snapshot = getSnapshot()\n const selected = selector(snapshot)\n\n if (\n selectedSnapshotRef.current === undefined ||\n !isEqual(selectedSnapshotRef.current, selected)\n ) {\n selectedSnapshotRef.current = selected\n }\n\n return selectedSnapshotRef.current\n }\n\n return useSyncExternalStore(subscribe, getSelectedSnapshot)\n}\n"],"mappings":";;AAeA,SAAgB,qBACd,WACA,aACA;CACA,MAAM,QAAQ,YAAY;CAE1B,MAAM,CAAC,EAAE,aAAa,eAAe,SAAmB,EACtD,WAAW;EAAE,QAAQ;EAAO,cAAc;CAAY,EACxD,CAAC;CAED,sBAAsB;EACpB,UAAU,SAAS;EACnB,UAAU,eAAe;EAEzB,IAAI,kBAAkB,SAAS,GAC7B,YAAY,EAAE,UAAU,CAAC;CAE7B,GAAG;EAAC;EAAW;EAAO;CAAW,CAAC;CAElC,gBAAgB;EACd,IAAI,kBAAkB,SAAS,GAC7B,YAAY,EAAE,UAAU,CAAC;EAG3B,OAAO,gBAAgB;GACrB,IAAI,kBAAkB,SAAS,GAC7B,YAAY,EAAE,UAAU,CAAC;EAE7B,CAAC;CACH,GAAG,CAAC,SAAS,CAAC;CAEd,OAAO;AACT;AAEA,SAAS,kBAAkB,MAGf;CACV,MAAM,oBAAoB,KAAK;CAC/B,MAAM,YAAY,KAAK;CACvB,IAAI;EACF,MAAM,YAAY,kBAAkB;EACpC,OAAO,CAAC,OAAO,GAAG,WAAW,SAAS;CACxC,SAAS,QAAQ;EACf,OAAO;CACT;AACF;AAEA,SAAgB,iCACd,WACA,aACA,UACA,SACW;CACX,MAAM,sBAAsB,OAA8B;CAE1D,MAAM,4BAA4B;EAEhC,MAAM,WAAW,SADA,YACgB,CAAC;EAElC,IACE,oBAAoB,YAAY,KAAA,KAChC,CAAC,QAAQ,oBAAoB,SAAS,QAAQ,GAE9C,oBAAoB,UAAU;EAGhC,OAAO,oBAAoB;CAC7B;CAEA,OAAO,qBAAqB,WAAW,mBAAmB;AAC5D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/preact-query",
3
- "version": "5.102.2",
3
+ "version": "5.102.3",
4
4
  "description": "Hooks for managing, caching and syncing asynchronous and remote data in preact",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
@@ -43,7 +43,7 @@
43
43
  "!build/codemods/**/__tests__"
44
44
  ],
45
45
  "dependencies": {
46
- "@tanstack/query-core": "5.102.2"
46
+ "@tanstack/query-core": "5.102.3"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@preact/preset-vite": "^2.10.2",
@@ -55,7 +55,7 @@
55
55
  "preact-render-to-string": "^6.6.4",
56
56
  "typescript": "6.0.3",
57
57
  "typescript-eslint": "^8.54.0",
58
- "@tanstack/query-persist-client-core": "5.102.2",
58
+ "@tanstack/query-persist-client-core": "5.102.3",
59
59
  "@tanstack/query-test-utils": "0.0.0"
60
60
  },
61
61
  "peerDependencies": {
@@ -61,7 +61,6 @@ export const HydrationBoundary = ({
61
61
  // State is supplied from the outside and we might as well fail
62
62
  // gracefully if it has the wrong shape, so while we type `queries`
63
63
  // as required, we still provide a fallback.
64
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
65
64
  const queries = state.queries || []
66
65
 
67
66
  const newQueries: DehydratedState['queries'] = []
@@ -23,6 +23,6 @@ export function usePrefetchQuery<
23
23
  const client = useQueryClient(queryClient)
24
24
 
25
25
  if (!client.getQueryState(options.queryKey)) {
26
- void client.fetchQuery(options).catch(noop)
26
+ void client.query(options).catch(noop)
27
27
  }
28
28
  }
package/src/utils.ts CHANGED
@@ -56,7 +56,6 @@ function didSnapshotChange(inst: {
56
56
  try {
57
57
  const nextValue = latestGetSnapshot()
58
58
  return !Object.is(prevValue, nextValue)
59
- // eslint-disable-next-line no-unused-vars
60
59
  } catch (_error) {
61
60
  return true
62
61
  }