1 line
4.1 KiB
JSON
1 line
4.1 KiB
JSON
{"ast":null,"code":"// src/suspense.ts\nvar defaultThrowOnError = (_error, query) => query.state.data === void 0;\nvar ensureSuspenseTimers = defaultedOptions => {\n if (defaultedOptions.suspense) {\n if (typeof defaultedOptions.staleTime !== \"number\") {\n defaultedOptions.staleTime = 1e3;\n }\n if (typeof defaultedOptions.gcTime === \"number\") {\n defaultedOptions.gcTime = Math.max(defaultedOptions.gcTime, 1e3);\n }\n }\n};\nvar willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring;\nvar shouldSuspend = (defaultedOptions, result) => defaultedOptions?.suspense && result.isPending;\nvar fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => {\n errorResetBoundary.clearReset();\n});\nexport { defaultThrowOnError, ensureSuspenseTimers, fetchOptimistic, shouldSuspend, willFetch };","map":{"version":3,"names":["defaultThrowOnError","_error","query","state","data","ensureSuspenseTimers","defaultedOptions","suspense","staleTime","gcTime","Math","max","willFetch","result","isRestoring","isLoading","isFetching","shouldSuspend","isPending","fetchOptimistic","observer","errorResetBoundary","catch","clearReset"],"sources":["/Users/shoofle/Projects/the-forest/client/node_modules/@tanstack/react-query/src/suspense.ts"],"sourcesContent":["import type {\n DefaultError,\n DefaultedQueryObserverOptions,\n Query,\n QueryKey,\n QueryObserver,\n QueryObserverResult,\n} from '@tanstack/query-core'\nimport type { QueryErrorResetBoundaryValue } from './QueryErrorResetBoundary'\n\nexport const defaultThrowOnError = <\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n _error: TError,\n query: Query<TQueryFnData, TError, TData, TQueryKey>,\n) => query.state.data === undefined\n\nexport const ensureSuspenseTimers = (\n defaultedOptions: DefaultedQueryObserverOptions<any, any, any, any, any>,\n) => {\n if (defaultedOptions.suspense) {\n // Always set stale time when using suspense to prevent\n // fetching again when directly mounting after suspending\n if (typeof defaultedOptions.staleTime !== 'number') {\n defaultedOptions.staleTime = 1000\n }\n if (typeof defaultedOptions.gcTime === 'number') {\n defaultedOptions.gcTime = Math.max(defaultedOptions.gcTime, 1000)\n }\n }\n}\n\nexport const willFetch = (\n result: QueryObserverResult<any, any>,\n isRestoring: boolean,\n) => result.isLoading && result.isFetching && !isRestoring\n\nexport const shouldSuspend = (\n defaultedOptions:\n | DefaultedQueryObserverOptions<any, any, any, any, any>\n | undefined,\n result: QueryObserverResult<any, any>,\n) => defaultedOptions?.suspense && result.isPending\n\nexport const fetchOptimistic = <\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n defaultedOptions: DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n observer: QueryObserver<TQueryFnData, TError, TData, TQueryData, TQueryKey>,\n errorResetBoundary: QueryErrorResetBoundaryValue,\n) =>\n observer.fetchOptimistic(defaultedOptions).catch(() => {\n errorResetBoundary.clearReset()\n })\n"],"mappings":";AAUO,IAAMA,mBAAA,GAAsBA,CAMjCC,MAAA,EACAC,KAAA,KACGA,KAAA,CAAMC,KAAA,CAAMC,IAAA,KAAS;AAEnB,IAAMC,oBAAA,GACXC,gBAAA,IACG;EACH,IAAIA,gBAAA,CAAiBC,QAAA,EAAU;IAG7B,IAAI,OAAOD,gBAAA,CAAiBE,SAAA,KAAc,UAAU;MAClDF,gBAAA,CAAiBE,SAAA,GAAY;IAC/B;IACA,IAAI,OAAOF,gBAAA,CAAiBG,MAAA,KAAW,UAAU;MAC/CH,gBAAA,CAAiBG,MAAA,GAASC,IAAA,CAAKC,GAAA,CAAIL,gBAAA,CAAiBG,MAAA,EAAQ,GAAI;IAClE;EACF;AACF;AAEO,IAAMG,SAAA,GAAYA,CACvBC,MAAA,EACAC,WAAA,KACGD,MAAA,CAAOE,SAAA,IAAaF,MAAA,CAAOG,UAAA,IAAc,CAACF,WAAA;AAExC,IAAMG,aAAA,GAAgBA,CAC3BX,gBAAA,EAGAO,MAAA,KACGP,gBAAA,EAAkBC,QAAA,IAAYM,MAAA,CAAOK,SAAA;AAEnC,IAAMC,eAAA,GAAkBA,CAO7Bb,gBAAA,EAOAc,QAAA,EACAC,kBAAA,KAEAD,QAAA,CAASD,eAAA,CAAgBb,gBAAgB,EAAEgB,KAAA,CAAM,MAAM;EACrDD,kBAAA,CAAmBE,UAAA,CAAW;AAChC,CAAC","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]} |