Skip to content
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

Merged
merged 29 commits into from
Dec 31, 2022
Merged

Remove overloads #4714

merged 29 commits into from
Dec 31, 2022

Conversation

Mamoanwar97
Copy link

@Mamoanwar97 Mamoanwar97 commented Dec 27, 2022

This PR attempts to fix #4694 of v5 milestones, In this PR:

  • remove overloads from query-core
  • remove overloads from react-query
  • remove overloads from solid-query
  • remove overloads from vue-query
  • update tests, docs, and examples accordingly

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
@codesandbox-ci
Copy link

codesandbox-ci bot commented Dec 27, 2022

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:

Sandbox Source
@tanstack/query-example-react-basic-typescript Configuration
@tanstack/query-example-solid-basic-typescript Configuration
@tanstack/query-example-vue-basic Configuration

@codecov-commenter
Copy link

codecov-commenter commented Dec 27, 2022

Codecov Report

❗ No coverage uploaded for pull request base (v5@af2e27e). Click here to learn what that means.
Patch has no changes to coverable lines.

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.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Collaborator

@TkDodo TkDodo left a 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

docs/react/adapters/solid-query.md Outdated Show resolved Hide resolved
Comment on lines +164 to 168
const query = createQuery({
queryKey: () => ['todos'],
queryFn: fetchTodos,
// ❌ passing a signal directly is not reactive
// enabled: enabled(),
Copy link
Collaborator

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

docs/react/guides/migrating-to-react-query-5.md Outdated Show resolved Hide resolved
examples/solid/basic-typescript/src/index.tsx Show resolved Hide resolved
packages/query-core/src/queryClient.ts Outdated Show resolved Hide resolved
packages/query-core/src/queryClient.ts Outdated Show resolved Hide resolved
packages/react-query/src/types.ts Show resolved Hide resolved
Comment on lines +9 to 18
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
}
Copy link
Collaborator

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 :)

packages/solid-query/src/createMutation.ts Outdated Show resolved Hide resolved
packages/vue-query/src/useBaseQuery.ts Outdated Show resolved Hide resolved
… argument

BREAKING CHANGE: getQueryData now accepts only queryKey as an argument
…an argument

BREAKING CHANGE: getQueryState now accepts only queryKey as an argument
@TkDodo TkDodo linked an issue Dec 29, 2022 that may be closed by this pull request
@TkDodo TkDodo merged commit eeec5f7 into TanStack:v5 Dec 31, 2022
@TkDodo
Copy link
Collaborator

TkDodo commented Dec 31, 2022

@allcontributors add @Mamoanwar97 for code

@allcontributors
Copy link
Contributor

@TkDodo

@Mamoanwar97 already contributed before to code

@TkDodo
Copy link
Collaborator

TkDodo commented Dec 31, 2022

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

remove overloads
5 participants