-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move queryOptions to its own file (#5480)
* refactor: remove 'use client' from non-components * refactor: move queryOptions to its own file where we don't have a 'use client' directive, because we can call this function on the server as well * Revert "refactor: remove 'use client' from non-components" This reverts commit 8ecac66. * refactor: rename isRestoring file * chore: fix import
- Loading branch information
Showing
5 changed files
with
50 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import type { DefaultError, QueryKey } from '@tanstack/query-core' | ||
import type { UseQueryOptions } from './types' | ||
|
||
export type UndefinedInitialDataOptions< | ||
TQueryFnData = unknown, | ||
TError = DefaultError, | ||
TData = TQueryFnData, | ||
TQueryKey extends QueryKey = QueryKey, | ||
> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & { | ||
initialData?: undefined | ||
} | ||
|
||
export type DefinedInitialDataOptions< | ||
TQueryFnData = unknown, | ||
TError = DefaultError, | ||
TData = TQueryFnData, | ||
TQueryKey extends QueryKey = QueryKey, | ||
> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & { | ||
initialData: TQueryFnData | (() => TQueryFnData) | ||
} | ||
|
||
export function queryOptions< | ||
TQueryFnData = unknown, | ||
TError = DefaultError, | ||
TData = TQueryFnData, | ||
TQueryKey extends QueryKey = QueryKey, | ||
>( | ||
options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>, | ||
): UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> | ||
|
||
export function queryOptions< | ||
TQueryFnData = unknown, | ||
TError = DefaultError, | ||
TData = TQueryFnData, | ||
TQueryKey extends QueryKey = QueryKey, | ||
>( | ||
options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>, | ||
): DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> | ||
|
||
export function queryOptions(options: unknown) { | ||
return options | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters