-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/query options #5153
Feature/query options #5153
Changes from 2 commits
744ad65
7b250eb
00b1a68
9551006
2830d11
18b36db
942154f
a896eeb
9c7123f
4276b10
07d6aa9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,28 @@ import type { | |
} from './types' | ||
import { useBaseQuery } from './useBaseQuery' | ||
|
||
export function queryOptions< | ||
TQueryFnData = unknown, | ||
TError = unknown, | ||
TData = TQueryFnData, | ||
TQueryKey extends QueryKey = QueryKey, | ||
>( | ||
options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>, | ||
): UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> | ||
|
||
export function queryOptions< | ||
TQueryFnData = unknown, | ||
TError = unknown, | ||
TData = TQueryFnData, | ||
TQueryKey extends QueryKey = QueryKey, | ||
>( | ||
options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>, | ||
): DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> | ||
|
||
export function queryOptions(options: unknown) { | ||
return options | ||
} | ||
Comment on lines
+11
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we move this to the core, @DamianOsipiuk ? The options are currently based on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah this would not work as in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. okay then let's let every framework export their own There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, i think that would be necessary. |
||
|
||
// HOOK | ||
type UndefinedInitialDataOptions< | ||
TQueryFnData = unknown, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is
query
specific, we would need similar helper forinfinite
,mutation
andqueries
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably not necessary for mutations, but for infinite: yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't even have the initialData overload for infiniteQuery 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add a separate helper in a follow-up. This is not breaking so we can add it at any time I think