1 line
41 KiB
JSON
1 line
41 KiB
JSON
{"ast":null,"code":"// src/query.ts\nimport { ensureQueryFn, noop, replaceData, resolveEnabled, timeUntilStale } from \"./utils.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { canFetch, createRetryer, isCancelledError } from \"./retryer.js\";\nimport { Removable } from \"./removable.js\";\nvar Query = class extends Removable {\n #initialState;\n #revertState;\n #cache;\n #retryer;\n #defaultOptions;\n #abortSignalConsumed;\n constructor(config) {\n super();\n this.#abortSignalConsumed = false;\n this.#defaultOptions = config.defaultOptions;\n this.setOptions(config.options);\n this.observers = [];\n this.#cache = config.cache;\n this.queryKey = config.queryKey;\n this.queryHash = config.queryHash;\n this.#initialState = getDefaultState(this.options);\n this.state = config.state ?? this.#initialState;\n this.scheduleGc();\n }\n get meta() {\n return this.options.meta;\n }\n get promise() {\n return this.#retryer?.promise;\n }\n setOptions(options) {\n this.options = {\n ...this.#defaultOptions,\n ...options\n };\n this.updateGcTime(this.options.gcTime);\n }\n optionalRemove() {\n if (!this.observers.length && this.state.fetchStatus === \"idle\") {\n this.#cache.remove(this);\n }\n }\n setData(newData, options) {\n const data = replaceData(this.state.data, newData, this.options);\n this.#dispatch({\n data,\n type: \"success\",\n dataUpdatedAt: options?.updatedAt,\n manual: options?.manual\n });\n return data;\n }\n setState(state, setStateOptions) {\n this.#dispatch({\n type: \"setState\",\n state,\n setStateOptions\n });\n }\n cancel(options) {\n const promise = this.#retryer?.promise;\n this.#retryer?.cancel(options);\n return promise ? promise.then(noop).catch(noop) : Promise.resolve();\n }\n destroy() {\n super.destroy();\n this.cancel({\n silent: true\n });\n }\n reset() {\n this.destroy();\n this.setState(this.#initialState);\n }\n isActive() {\n return this.observers.some(observer => resolveEnabled(observer.options.enabled, this) !== false);\n }\n isDisabled() {\n return this.getObserversCount() > 0 && !this.isActive();\n }\n isStale() {\n if (this.state.isInvalidated) {\n return true;\n }\n if (this.getObserversCount() > 0) {\n return this.observers.some(observer => observer.getCurrentResult().isStale);\n }\n return this.state.data === void 0;\n }\n isStaleByTime(staleTime = 0) {\n return this.state.isInvalidated || this.state.data === void 0 || !timeUntilStale(this.state.dataUpdatedAt, staleTime);\n }\n onFocus() {\n const observer = this.observers.find(x => x.shouldFetchOnWindowFocus());\n observer?.refetch({\n cancelRefetch: false\n });\n this.#retryer?.continue();\n }\n onOnline() {\n const observer = this.observers.find(x => x.shouldFetchOnReconnect());\n observer?.refetch({\n cancelRefetch: false\n });\n this.#retryer?.continue();\n }\n addObserver(observer) {\n if (!this.observers.includes(observer)) {\n this.observers.push(observer);\n this.clearGcTimeout();\n this.#cache.notify({\n type: \"observerAdded\",\n query: this,\n observer\n });\n }\n }\n removeObserver(observer) {\n if (this.observers.includes(observer)) {\n this.observers = this.observers.filter(x => x !== observer);\n if (!this.observers.length) {\n if (this.#retryer) {\n if (this.#abortSignalConsumed) {\n this.#retryer.cancel({\n revert: true\n });\n } else {\n this.#retryer.cancelRetry();\n }\n }\n this.scheduleGc();\n }\n this.#cache.notify({\n type: \"observerRemoved\",\n query: this,\n observer\n });\n }\n }\n getObserversCount() {\n return this.observers.length;\n }\n invalidate() {\n if (!this.state.isInvalidated) {\n this.#dispatch({\n type: \"invalidate\"\n });\n }\n }\n fetch(options, fetchOptions) {\n if (this.state.fetchStatus !== \"idle\") {\n if (this.state.data !== void 0 && fetchOptions?.cancelRefetch) {\n this.cancel({\n silent: true\n });\n } else if (this.#retryer) {\n this.#retryer.continueRetry();\n return this.#retryer.promise;\n }\n }\n if (options) {\n this.setOptions(options);\n }\n if (!this.options.queryFn) {\n const observer = this.observers.find(x => x.options.queryFn);\n if (observer) {\n this.setOptions(observer.options);\n }\n }\n if (process.env.NODE_ENV !== \"production\") {\n if (!Array.isArray(this.options.queryKey)) {\n console.error(`As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']`);\n }\n }\n const abortController = new AbortController();\n const addSignalProperty = object => {\n Object.defineProperty(object, \"signal\", {\n enumerable: true,\n get: () => {\n this.#abortSignalConsumed = true;\n return abortController.signal;\n }\n });\n };\n const fetchFn = () => {\n const queryFn = ensureQueryFn(this.options, fetchOptions);\n const queryFnContext = {\n queryKey: this.queryKey,\n meta: this.meta\n };\n addSignalProperty(queryFnContext);\n this.#abortSignalConsumed = false;\n if (this.options.persister) {\n return this.options.persister(queryFn, queryFnContext, this);\n }\n return queryFn(queryFnContext);\n };\n const context = {\n fetchOptions,\n options: this.options,\n queryKey: this.queryKey,\n state: this.state,\n fetchFn\n };\n addSignalProperty(context);\n this.options.behavior?.onFetch(context, this);\n this.#revertState = this.state;\n if (this.state.fetchStatus === \"idle\" || this.state.fetchMeta !== context.fetchOptions?.meta) {\n this.#dispatch({\n type: \"fetch\",\n meta: context.fetchOptions?.meta\n });\n }\n const onError = error => {\n if (!(isCancelledError(error) && error.silent)) {\n this.#dispatch({\n type: \"error\",\n error\n });\n }\n if (!isCancelledError(error)) {\n this.#cache.config.onError?.(error, this);\n this.#cache.config.onSettled?.(this.state.data, error, this);\n }\n if (!this.isFetchingOptimistic) {\n this.scheduleGc();\n }\n this.isFetchingOptimistic = false;\n };\n this.#retryer = createRetryer({\n initialPromise: fetchOptions?.initialPromise,\n fn: context.fetchFn,\n abort: abortController.abort.bind(abortController),\n onSuccess: data => {\n if (data === void 0) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`);\n }\n onError(new Error(`${this.queryHash} data is undefined`));\n return;\n }\n try {\n this.setData(data);\n } catch (error) {\n onError(error);\n return;\n }\n this.#cache.config.onSuccess?.(data, this);\n this.#cache.config.onSettled?.(data, this.state.error, this);\n if (!this.isFetchingOptimistic) {\n this.scheduleGc();\n }\n this.isFetchingOptimistic = false;\n },\n onError,\n onFail: (failureCount, error) => {\n this.#dispatch({\n type: \"failed\",\n failureCount,\n error\n });\n },\n onPause: () => {\n this.#dispatch({\n type: \"pause\"\n });\n },\n onContinue: () => {\n this.#dispatch({\n type: \"continue\"\n });\n },\n retry: context.options.retry,\n retryDelay: context.options.retryDelay,\n networkMode: context.options.networkMode,\n canRun: () => true\n });\n return this.#retryer.start();\n }\n #dispatch(action) {\n const reducer = state => {\n switch (action.type) {\n case \"failed\":\n return {\n ...state,\n fetchFailureCount: action.failureCount,\n fetchFailureReason: action.error\n };\n case \"pause\":\n return {\n ...state,\n fetchStatus: \"paused\"\n };\n case \"continue\":\n return {\n ...state,\n fetchStatus: \"fetching\"\n };\n case \"fetch\":\n return {\n ...state,\n ...fetchState(state.data, this.options),\n fetchMeta: action.meta ?? null\n };\n case \"success\":\n return {\n ...state,\n data: action.data,\n dataUpdateCount: state.dataUpdateCount + 1,\n dataUpdatedAt: action.dataUpdatedAt ?? Date.now(),\n error: null,\n isInvalidated: false,\n status: \"success\",\n ...(!action.manual && {\n fetchStatus: \"idle\",\n fetchFailureCount: 0,\n fetchFailureReason: null\n })\n };\n case \"error\":\n const error = action.error;\n if (isCancelledError(error) && error.revert && this.#revertState) {\n return {\n ...this.#revertState,\n fetchStatus: \"idle\"\n };\n }\n return {\n ...state,\n error,\n errorUpdateCount: state.errorUpdateCount + 1,\n errorUpdatedAt: Date.now(),\n fetchFailureCount: state.fetchFailureCount + 1,\n fetchFailureReason: error,\n fetchStatus: \"idle\",\n status: \"error\"\n };\n case \"invalidate\":\n return {\n ...state,\n isInvalidated: true\n };\n case \"setState\":\n return {\n ...state,\n ...action.state\n };\n }\n };\n this.state = reducer(this.state);\n notifyManager.batch(() => {\n this.observers.forEach(observer => {\n observer.onQueryUpdate();\n });\n this.#cache.notify({\n query: this,\n type: \"updated\",\n action\n });\n });\n }\n};\nfunction fetchState(data, options) {\n return {\n fetchFailureCount: 0,\n fetchFailureReason: null,\n fetchStatus: canFetch(options.networkMode) ? \"fetching\" : \"paused\",\n ...(data === void 0 && {\n error: null,\n status: \"pending\"\n })\n };\n}\nfunction getDefaultState(options) {\n const data = typeof options.initialData === \"function\" ? options.initialData() : options.initialData;\n const hasData = data !== void 0;\n const initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === \"function\" ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;\n return {\n data,\n dataUpdateCount: 0,\n dataUpdatedAt: hasData ? initialDataUpdatedAt ?? Date.now() : 0,\n error: null,\n errorUpdateCount: 0,\n errorUpdatedAt: 0,\n fetchFailureCount: 0,\n fetchFailureReason: null,\n fetchMeta: null,\n isInvalidated: false,\n status: hasData ? \"success\" : \"pending\",\n fetchStatus: \"idle\"\n };\n}\nexport { Query, fetchState };","map":{"version":3,"names":["ensureQueryFn","noop","replaceData","resolveEnabled","timeUntilStale","notifyManager","canFetch","createRetryer","isCancelledError","Removable","Query","initialState","revertState","cache","retryer","defaultOptions","abortSignalConsumed","constructor","config","setOptions","options","observers","queryKey","queryHash","getDefaultState","state","scheduleGc","meta","promise","updateGcTime","gcTime","optionalRemove","length","fetchStatus","remove","setData","newData","data","dispatch","type","dataUpdatedAt","updatedAt","manual","setState","setStateOptions","cancel","then","catch","Promise","resolve","destroy","silent","reset","isActive","some","observer","enabled","isDisabled","getObserversCount","isStale","isInvalidated","getCurrentResult","isStaleByTime","staleTime","onFocus","find","x","shouldFetchOnWindowFocus","refetch","cancelRefetch","continue","onOnline","shouldFetchOnReconnect","addObserver","includes","push","clearGcTimeout","notify","query","removeObserver","filter","revert","cancelRetry","invalidate","fetch","fetchOptions","continueRetry","queryFn","process","env","NODE_ENV","Array","isArray","console","error","abortController","AbortController","addSignalProperty","object","Object","defineProperty","enumerable","get","signal","fetchFn","queryFnContext","persister","context","behavior","onFetch","fetchMeta","onError","onSettled","isFetchingOptimistic","initialPromise","fn","abort","bind","onSuccess","Error","onFail","failureCount","onPause","onContinue","retry","retryDelay","networkMode","canRun","start","#dispatch","action","reducer","fetchFailureCount","fetchFailureReason","fetchState","dataUpdateCount","Date","now","status","errorUpdateCount","errorUpdatedAt","batch","forEach","onQueryUpdate","initialData","hasData","initialDataUpdatedAt"],"sources":["/Users/shoofle/Projects/the-forest/client/node_modules/@tanstack/query-core/src/query.ts"],"sourcesContent":["import {\n ensureQueryFn,\n noop,\n replaceData,\n resolveEnabled,\n timeUntilStale,\n} from './utils'\nimport { notifyManager } from './notifyManager'\nimport { canFetch, createRetryer, isCancelledError } from './retryer'\nimport { Removable } from './removable'\nimport type {\n CancelOptions,\n DefaultError,\n FetchStatus,\n InitialDataFunction,\n OmitKeyof,\n QueryFunction,\n QueryFunctionContext,\n QueryKey,\n QueryMeta,\n QueryOptions,\n QueryStatus,\n SetDataOptions,\n} from './types'\nimport type { QueryCache } from './queryCache'\nimport type { QueryObserver } from './queryObserver'\nimport type { Retryer } from './retryer'\n\n// TYPES\n\ninterface QueryConfig<\n TQueryFnData,\n TError,\n TData,\n TQueryKey extends QueryKey = QueryKey,\n> {\n cache: QueryCache\n queryKey: TQueryKey\n queryHash: string\n options?: QueryOptions<TQueryFnData, TError, TData, TQueryKey>\n defaultOptions?: QueryOptions<TQueryFnData, TError, TData, TQueryKey>\n state?: QueryState<TData, TError>\n}\n\nexport interface QueryState<TData = unknown, TError = DefaultError> {\n data: TData | undefined\n dataUpdateCount: number\n dataUpdatedAt: number\n error: TError | null\n errorUpdateCount: number\n errorUpdatedAt: number\n fetchFailureCount: number\n fetchFailureReason: TError | null\n fetchMeta: FetchMeta | null\n isInvalidated: boolean\n status: QueryStatus\n fetchStatus: FetchStatus\n}\n\nexport interface FetchContext<\n TQueryFnData,\n TError,\n TData,\n TQueryKey extends QueryKey = QueryKey,\n> {\n fetchFn: () => unknown | Promise<unknown>\n fetchOptions?: FetchOptions\n signal: AbortSignal\n options: QueryOptions<TQueryFnData, TError, TData, any>\n queryKey: TQueryKey\n state: QueryState<TData, TError>\n}\n\nexport interface QueryBehavior<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> {\n onFetch: (\n context: FetchContext<TQueryFnData, TError, TData, TQueryKey>,\n query: Query,\n ) => void\n}\n\nexport type FetchDirection = 'forward' | 'backward'\n\nexport interface FetchMeta {\n fetchMore?: { direction: FetchDirection }\n}\n\nexport interface FetchOptions<TData = unknown> {\n cancelRefetch?: boolean\n meta?: FetchMeta\n initialPromise?: Promise<TData>\n}\n\ninterface FailedAction<TError> {\n type: 'failed'\n failureCount: number\n error: TError\n}\n\ninterface FetchAction {\n type: 'fetch'\n meta?: FetchMeta\n}\n\ninterface SuccessAction<TData> {\n data: TData | undefined\n type: 'success'\n dataUpdatedAt?: number\n manual?: boolean\n}\n\ninterface ErrorAction<TError> {\n type: 'error'\n error: TError\n}\n\ninterface InvalidateAction {\n type: 'invalidate'\n}\n\ninterface PauseAction {\n type: 'pause'\n}\n\ninterface ContinueAction {\n type: 'continue'\n}\n\ninterface SetStateAction<TData, TError> {\n type: 'setState'\n state: Partial<QueryState<TData, TError>>\n setStateOptions?: SetStateOptions\n}\n\nexport type Action<TData, TError> =\n | ContinueAction\n | ErrorAction<TError>\n | FailedAction<TError>\n | FetchAction\n | InvalidateAction\n | PauseAction\n | SetStateAction<TData, TError>\n | SuccessAction<TData>\n\nexport interface SetStateOptions {\n meta?: any\n}\n\n// CLASS\n\nexport class Query<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> extends Removable {\n queryKey: TQueryKey\n queryHash: string\n options!: QueryOptions<TQueryFnData, TError, TData, TQueryKey>\n state: QueryState<TData, TError>\n isFetchingOptimistic?: boolean\n\n #initialState: QueryState<TData, TError>\n #revertState?: QueryState<TData, TError>\n #cache: QueryCache\n #retryer?: Retryer<TData>\n observers: Array<QueryObserver<any, any, any, any, any>>\n #defaultOptions?: QueryOptions<TQueryFnData, TError, TData, TQueryKey>\n #abortSignalConsumed: boolean\n\n constructor(config: QueryConfig<TQueryFnData, TError, TData, TQueryKey>) {\n super()\n\n this.#abortSignalConsumed = false\n this.#defaultOptions = config.defaultOptions\n this.setOptions(config.options)\n this.observers = []\n this.#cache = config.cache\n this.queryKey = config.queryKey\n this.queryHash = config.queryHash\n this.#initialState = getDefaultState(this.options)\n this.state = config.state ?? this.#initialState\n this.scheduleGc()\n }\n get meta(): QueryMeta | undefined {\n return this.options.meta\n }\n\n get promise(): Promise<TData> | undefined {\n return this.#retryer?.promise\n }\n\n setOptions(\n options?: QueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n ): void {\n this.options = { ...this.#defaultOptions, ...options }\n\n this.updateGcTime(this.options.gcTime)\n }\n\n protected optionalRemove() {\n if (!this.observers.length && this.state.fetchStatus === 'idle') {\n this.#cache.remove(this)\n }\n }\n\n setData(\n newData: TData,\n options?: SetDataOptions & { manual: boolean },\n ): TData {\n const data = replaceData(this.state.data, newData, this.options)\n\n // Set data and mark it as cached\n this.#dispatch({\n data,\n type: 'success',\n dataUpdatedAt: options?.updatedAt,\n manual: options?.manual,\n })\n\n return data\n }\n\n setState(\n state: Partial<QueryState<TData, TError>>,\n setStateOptions?: SetStateOptions,\n ): void {\n this.#dispatch({ type: 'setState', state, setStateOptions })\n }\n\n cancel(options?: CancelOptions): Promise<void> {\n const promise = this.#retryer?.promise\n this.#retryer?.cancel(options)\n return promise ? promise.then(noop).catch(noop) : Promise.resolve()\n }\n\n destroy(): void {\n super.destroy()\n\n this.cancel({ silent: true })\n }\n\n reset(): void {\n this.destroy()\n this.setState(this.#initialState)\n }\n\n isActive(): boolean {\n return this.observers.some(\n (observer) => resolveEnabled(observer.options.enabled, this) !== false,\n )\n }\n\n isDisabled(): boolean {\n return this.getObserversCount() > 0 && !this.isActive()\n }\n\n isStale(): boolean {\n if (this.state.isInvalidated) {\n return true\n }\n\n if (this.getObserversCount() > 0) {\n return this.observers.some(\n (observer) => observer.getCurrentResult().isStale,\n )\n }\n\n return this.state.data === undefined\n }\n\n isStaleByTime(staleTime = 0): boolean {\n return (\n this.state.isInvalidated ||\n this.state.data === undefined ||\n !timeUntilStale(this.state.dataUpdatedAt, staleTime)\n )\n }\n\n onFocus(): void {\n const observer = this.observers.find((x) => x.shouldFetchOnWindowFocus())\n\n observer?.refetch({ cancelRefetch: false })\n\n // Continue fetch if currently paused\n this.#retryer?.continue()\n }\n\n onOnline(): void {\n const observer = this.observers.find((x) => x.shouldFetchOnReconnect())\n\n observer?.refetch({ cancelRefetch: false })\n\n // Continue fetch if currently paused\n this.#retryer?.continue()\n }\n\n addObserver(observer: QueryObserver<any, any, any, any, any>): void {\n if (!this.observers.includes(observer)) {\n this.observers.push(observer)\n\n // Stop the query from being garbage collected\n this.clearGcTimeout()\n\n this.#cache.notify({ type: 'observerAdded', query: this, observer })\n }\n }\n\n removeObserver(observer: QueryObserver<any, any, any, any, any>): void {\n if (this.observers.includes(observer)) {\n this.observers = this.observers.filter((x) => x !== observer)\n\n if (!this.observers.length) {\n // If the transport layer does not support cancellation\n // we'll let the query continue so the result can be cached\n if (this.#retryer) {\n if (this.#abortSignalConsumed) {\n this.#retryer.cancel({ revert: true })\n } else {\n this.#retryer.cancelRetry()\n }\n }\n\n this.scheduleGc()\n }\n\n this.#cache.notify({ type: 'observerRemoved', query: this, observer })\n }\n }\n\n getObserversCount(): number {\n return this.observers.length\n }\n\n invalidate(): void {\n if (!this.state.isInvalidated) {\n this.#dispatch({ type: 'invalidate' })\n }\n }\n\n fetch(\n options?: QueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n fetchOptions?: FetchOptions<TQueryFnData>,\n ): Promise<TData> {\n if (this.state.fetchStatus !== 'idle') {\n if (this.state.data !== undefined && fetchOptions?.cancelRefetch) {\n // Silently cancel current fetch if the user wants to cancel refetch\n this.cancel({ silent: true })\n } else if (this.#retryer) {\n // make sure that retries that were potentially cancelled due to unmounts can continue\n this.#retryer.continueRetry()\n // Return current promise if we are already fetching\n return this.#retryer.promise\n }\n }\n\n // Update config if passed, otherwise the config from the last execution is used\n if (options) {\n this.setOptions(options)\n }\n\n // Use the options from the first observer with a query function if no function is found.\n // This can happen when the query is hydrated or created with setQueryData.\n if (!this.options.queryFn) {\n const observer = this.observers.find((x) => x.options.queryFn)\n if (observer) {\n this.setOptions(observer.options)\n }\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (!Array.isArray(this.options.queryKey)) {\n console.error(\n `As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']`,\n )\n }\n }\n\n const abortController = new AbortController()\n\n // Adds an enumerable signal property to the object that\n // which sets abortSignalConsumed to true when the signal\n // is read.\n const addSignalProperty = (object: unknown) => {\n Object.defineProperty(object, 'signal', {\n enumerable: true,\n get: () => {\n this.#abortSignalConsumed = true\n return abortController.signal\n },\n })\n }\n\n // Create fetch function\n const fetchFn = () => {\n const queryFn = ensureQueryFn(this.options, fetchOptions)\n\n // Create query function context\n const queryFnContext: OmitKeyof<\n QueryFunctionContext<TQueryKey>,\n 'signal'\n > = {\n queryKey: this.queryKey,\n meta: this.meta,\n }\n\n addSignalProperty(queryFnContext)\n\n this.#abortSignalConsumed = false\n if (this.options.persister) {\n return this.options.persister(\n queryFn as QueryFunction<any>,\n queryFnContext as QueryFunctionContext<TQueryKey>,\n this as unknown as Query,\n )\n }\n\n return queryFn(queryFnContext as QueryFunctionContext<TQueryKey>)\n }\n\n // Trigger behavior hook\n const context: OmitKeyof<\n FetchContext<TQueryFnData, TError, TData, TQueryKey>,\n 'signal'\n > = {\n fetchOptions,\n options: this.options,\n queryKey: this.queryKey,\n state: this.state,\n fetchFn,\n }\n\n addSignalProperty(context)\n\n this.options.behavior?.onFetch(\n context as FetchContext<TQueryFnData, TError, TData, TQueryKey>,\n this as unknown as Query,\n )\n\n // Store state in case the current fetch needs to be reverted\n this.#revertState = this.state\n\n // Set to fetching state if not already in it\n if (\n this.state.fetchStatus === 'idle' ||\n this.state.fetchMeta !== context.fetchOptions?.meta\n ) {\n this.#dispatch({ type: 'fetch', meta: context.fetchOptions?.meta })\n }\n\n const onError = (error: TError | { silent?: boolean }) => {\n // Optimistically update state if needed\n if (!(isCancelledError(error) && error.silent)) {\n this.#dispatch({\n type: 'error',\n error: error as TError,\n })\n }\n\n if (!isCancelledError(error)) {\n // Notify cache callback\n this.#cache.config.onError?.(\n error as any,\n this as Query<any, any, any, any>,\n )\n this.#cache.config.onSettled?.(\n this.state.data,\n error as any,\n this as Query<any, any, any, any>,\n )\n }\n\n if (!this.isFetchingOptimistic) {\n // Schedule query gc after fetching\n this.scheduleGc()\n }\n this.isFetchingOptimistic = false\n }\n\n // Try to fetch the data\n this.#retryer = createRetryer({\n initialPromise: fetchOptions?.initialPromise as\n | Promise<TData>\n | undefined,\n fn: context.fetchFn as () => Promise<TData>,\n abort: abortController.abort.bind(abortController),\n onSuccess: (data) => {\n if (data === undefined) {\n if (process.env.NODE_ENV !== 'production') {\n console.error(\n `Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`,\n )\n }\n onError(new Error(`${this.queryHash} data is undefined`) as any)\n return\n }\n\n try {\n this.setData(data)\n } catch (error) {\n onError(error as TError)\n return\n }\n\n // Notify cache callback\n this.#cache.config.onSuccess?.(data, this as Query<any, any, any, any>)\n this.#cache.config.onSettled?.(\n data,\n this.state.error as any,\n this as Query<any, any, any, any>,\n )\n\n if (!this.isFetchingOptimistic) {\n // Schedule query gc after fetching\n this.scheduleGc()\n }\n this.isFetchingOptimistic = false\n },\n onError,\n onFail: (failureCount, error) => {\n this.#dispatch({ type: 'failed', failureCount, error })\n },\n onPause: () => {\n this.#dispatch({ type: 'pause' })\n },\n onContinue: () => {\n this.#dispatch({ type: 'continue' })\n },\n retry: context.options.retry,\n retryDelay: context.options.retryDelay,\n networkMode: context.options.networkMode,\n canRun: () => true,\n })\n\n return this.#retryer.start()\n }\n\n #dispatch(action: Action<TData, TError>): void {\n const reducer = (\n state: QueryState<TData, TError>,\n ): QueryState<TData, TError> => {\n switch (action.type) {\n case 'failed':\n return {\n ...state,\n fetchFailureCount: action.failureCount,\n fetchFailureReason: action.error,\n }\n case 'pause':\n return {\n ...state,\n fetchStatus: 'paused',\n }\n case 'continue':\n return {\n ...state,\n fetchStatus: 'fetching',\n }\n case 'fetch':\n return {\n ...state,\n ...fetchState(state.data, this.options),\n fetchMeta: action.meta ?? null,\n }\n case 'success':\n return {\n ...state,\n data: action.data,\n dataUpdateCount: state.dataUpdateCount + 1,\n dataUpdatedAt: action.dataUpdatedAt ?? Date.now(),\n error: null,\n isInvalidated: false,\n status: 'success',\n ...(!action.manual && {\n fetchStatus: 'idle',\n fetchFailureCount: 0,\n fetchFailureReason: null,\n }),\n }\n case 'error':\n const error = action.error\n\n if (isCancelledError(error) && error.revert && this.#revertState) {\n return { ...this.#revertState, fetchStatus: 'idle' }\n }\n\n return {\n ...state,\n error,\n errorUpdateCount: state.errorUpdateCount + 1,\n errorUpdatedAt: Date.now(),\n fetchFailureCount: state.fetchFailureCount + 1,\n fetchFailureReason: error,\n fetchStatus: 'idle',\n status: 'error',\n }\n case 'invalidate':\n return {\n ...state,\n isInvalidated: true,\n }\n case 'setState':\n return {\n ...state,\n ...action.state,\n }\n }\n }\n\n this.state = reducer(this.state)\n\n notifyManager.batch(() => {\n this.observers.forEach((observer) => {\n observer.onQueryUpdate()\n })\n\n this.#cache.notify({ query: this, type: 'updated', action })\n })\n }\n}\n\nexport function fetchState<\n TQueryFnData,\n TError,\n TData,\n TQueryKey extends QueryKey,\n>(\n data: TData | undefined,\n options: QueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n) {\n return {\n fetchFailureCount: 0,\n fetchFailureReason: null,\n fetchStatus: canFetch(options.networkMode) ? 'fetching' : 'paused',\n ...(data === undefined &&\n ({\n error: null,\n status: 'pending',\n } as const)),\n } as const\n}\n\nfunction getDefaultState<\n TQueryFnData,\n TError,\n TData,\n TQueryKey extends QueryKey,\n>(\n options: QueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n): QueryState<TData, TError> {\n const data =\n typeof options.initialData === 'function'\n ? (options.initialData as InitialDataFunction<TData>)()\n : options.initialData\n\n const hasData = data !== undefined\n\n const initialDataUpdatedAt = hasData\n ? typeof options.initialDataUpdatedAt === 'function'\n ? (options.initialDataUpdatedAt as () => number | undefined)()\n : options.initialDataUpdatedAt\n : 0\n\n return {\n data,\n dataUpdateCount: 0,\n dataUpdatedAt: hasData ? (initialDataUpdatedAt ?? Date.now()) : 0,\n error: null,\n errorUpdateCount: 0,\n errorUpdatedAt: 0,\n fetchFailureCount: 0,\n fetchFailureReason: null,\n fetchMeta: null,\n isInvalidated: false,\n status: hasData ? 'success' : 'pending',\n fetchStatus: 'idle',\n }\n}\n"],"mappings":";AAAA,SACEA,aAAA,EACAC,IAAA,EACAC,WAAA,EACAC,cAAA,EACAC,cAAA,QACK;AACP,SAASC,aAAA,QAAqB;AAC9B,SAASC,QAAA,EAAUC,aAAA,EAAeC,gBAAA,QAAwB;AAC1D,SAASC,SAAA,QAAiB;AAiJnB,IAAMC,KAAA,GAAN,cAKGD,SAAA,CAAU;EAOlB,CAAAE,YAAA;EACA,CAAAC,WAAA;EACA,CAAAC,KAAA;EACA,CAAAC,OAAA;EAEA,CAAAC,cAAA;EACA,CAAAC,mBAAA;EAEAC,YAAYC,MAAA,EAA6D;IACvE,MAAM;IAEN,KAAK,CAAAF,mBAAA,GAAuB;IAC5B,KAAK,CAAAD,cAAA,GAAkBG,MAAA,CAAOH,cAAA;IAC9B,KAAKI,UAAA,CAAWD,MAAA,CAAOE,OAAO;IAC9B,KAAKC,SAAA,GAAY,EAAC;IAClB,KAAK,CAAAR,KAAA,GAASK,MAAA,CAAOL,KAAA;IACrB,KAAKS,QAAA,GAAWJ,MAAA,CAAOI,QAAA;IACvB,KAAKC,SAAA,GAAYL,MAAA,CAAOK,SAAA;IACxB,KAAK,CAAAZ,YAAA,GAAgBa,eAAA,CAAgB,KAAKJ,OAAO;IACjD,KAAKK,KAAA,GAAQP,MAAA,CAAOO,KAAA,IAAS,KAAK,CAAAd,YAAA;IAClC,KAAKe,UAAA,CAAW;EAClB;EACA,IAAIC,KAAA,EAA8B;IAChC,OAAO,KAAKP,OAAA,CAAQO,IAAA;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