-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
[WIP] feat: update @ngneat/query
to use the newest @tanstack/query
version
#117
Conversation
... `@tanstack/react-query-devtools` version to `5.4.3`
Adjusts Types to reflect the new `@tanstack/react-query` (in v5) BREAKING CHANGE: 🧨 Removed all overloads with the exception of the object style, like `@tanstack/react-query` (in v5) now requires you to ✅ Closes: 116
Run & review this pull request in StackBlitz Codeflow. |
@ngneat/query
to use the newest @tanstack/query
version
return buildQuery( | ||
this.instance, | ||
InfiniteQueryObserver as typeof QueryObserver, | ||
parsedOptions | ||
options 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.
@NetanelBasal For now i typed this as any
since i dont really know how to convert between them, maybe a bit help would be great.
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.
You still need multiple overloads. See for example the svelte version:
https://github.com/TanStack/query/blob/v5.4.2/packages/svelte-query/src/createQuery.ts
return buildQuery( | ||
this.instance, | ||
QueryObserver, | ||
parsedOptions | ||
options as QueryOptions |
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.
Same for this conversion, i'd say this one is not as bad as the infinite query one but still what would you say?
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.
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.
uhhm, i think the links got mixed up, the createQuery
overloads from the svelte adapter are the same, both have the initialData defined or undefined overload. was this intentionally?
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.
Yes, we should copy the same overload and only change the queryFn and return data
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.
In general I recommend to see that the types and overloads are equal to one of the existing adapters such as svelte or vue js
package.json
Outdated
"@ngneat/subscribe": "^3.0.2", | ||
"@tanstack/react-query": "^4.12.0", | ||
"@tanstack/react-query-devtools": "^4.12.0", | ||
"@tanstack/react-query": "^5.4.3", |
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.
There is no need to use the react version anymore. You can do what he did here:
return buildQuery( | ||
this.instance, | ||
InfiniteQueryObserver as typeof QueryObserver, | ||
parsedOptions | ||
options 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.
You still need multiple overloads. See for example the svelte version:
https://github.com/TanStack/query/blob/v5.4.2/packages/svelte-query/src/createQuery.ts
return buildQuery( | ||
this.instance, | ||
QueryObserver, | ||
parsedOptions | ||
options as QueryOptions |
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.
remove react as dependency and use `@tanstack/query-devtools`
and expose provider in barrel export
`mutation-result`
@luii I already starts the refactoring. Do you want to collaborate? I'm actually writing it from scratch. Already have the base query and infinity done. |
@NetanelBasal oh okay, i havent seen that, sorry that i havent done anything since last week, i was really busy with work. if you have something i should do/can do, then yeah of course |
The question is how much time you have? because I want to close this version in two weeks most. |
Only this week was rough, next and the week after that should be fine, if something comes up i will let you know in advance on the end of monday |
Cool, let me see what I can give you and I'll let you know. Thanks |
Hi, These are the new changes:
Missing things that you can do:
You can work on the next branch. LMK if it's ok and you can do it. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Current behavior reflects still
v4
of@tanstack/react-query
's api styleIssue Number: #116
What is the new behavior?
New behavior reflects
v5
of@tanstack/react-query
's api styleInfiniteData
Interface (exported type from@tanstack/query-core
) to theInfiniteQueryService
return type to reflect what is actually being returnedTError
now defaults toDefaultError
(exported type from@tanstack/query-core
) instead ofunknown
operators
to reflect changes made bytanstack
@ngneat/subscribe
as dependency to illustrate that the code can be used without it and used*ngIf
andAsyncPipe
insteadDoes this PR introduce a breaking change?
@tanstack/react-query
,@tanstack/query-core
and@tanstack/react-query-devtools
to the neweset versionInfiniteQueryService
,QueryService
Other information