-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Remove overloads #4714
Remove overloads #4714
Conversation
remove overloads and only allow all functions to be called with a single signature BREAKING CHANGE: Overloads are removed, query-core now supports a single signature
remove overloads and only allow all functions to be called with a single signature BREAKING CHANGE: Overloads are removed, react-query now supports a single signature
remove overloads and only allow all functions to be called with a single signature BREAKING CHANGE: Overloads are removed, solid-query now supports a single signature
remove overloads and only allow all functions to be called with a single signature BREAKING CHANGE: Overloads are removed, vue-query now supports a single signature
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 2bf7484:
|
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## v5 #4714 +/- ##
=====================================
Coverage ? 92.30%
=====================================
Files ? 89
Lines ? 3641
Branches ? 949
=====================================
Hits ? 3361
Misses ? 265
Partials ? 15 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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.
awesome work, this is huge 🙌 . Please have a look at my comments
const query = createQuery({ | ||
queryKey: () => ['todos'], | ||
queryFn: fetchTodos, | ||
// ❌ passing a signal directly is not reactive | ||
// enabled: enabled(), |
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 think this workaround is also unnecessary without the overloads. @ardeora can you have a look please
export function normalizeQueryOptions<T>(arg: T): T { | ||
const { queryKey: solidKey, ...opts } = arg as any | ||
if (solidKey) { | ||
return { | ||
...opts, | ||
queryKey: solidKey(), | ||
} | ||
return arg1 as any | ||
} | ||
|
||
if (typeof arg2 === 'function') { | ||
return { ...arg3, queryKey: arg1(), queryFn: arg2 } as any | ||
} | ||
|
||
return { ...arg2, queryKey: arg1() } as any | ||
return arg as any | ||
} |
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.
not sure if this is still necessary. from what I can see, it tries to make the queryKey reactive ? I guess we'd now want that for the whole options object? Another question for @ardeora :)
b34e4b6
to
3346d5a
Compare
… argument BREAKING CHANGE: getQueryData now accepts only queryKey as an argument
…an argument BREAKING CHANGE: getQueryState now accepts only queryKey as an argument
@allcontributors add @Mamoanwar97 for code |
@Mamoanwar97 already contributed before to code |
@ardeora merged. Please create a follow up PR to address the open solid todos (or just an issue if you'd want someone else to tackle it). @DamianOsipiuk I don't think there is anything open for vue, but if there is, let's also create a follow-up |
This PR attempts to fix #4694 of v5 milestones, In this PR: