-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: update angular version, code DX, examples and tests #1
feat: update angular version, code DX, examples and tests #1
Conversation
Awesome PR, thanks! Will look at it more tomorrow. Will be fun also to think of how to architecture Angular apps around TanStack Query, e.g. what role would services have in this? One way is to define a default queryFn via the QueryClient options and pass enough information via the query key so the query fn can fetch data. Then you'd need some kind of key factory (or multiple) which could be in services and only essential logic would remain in components. Disadvantage is that having correct types is quite hard then but other than that I'm fond of this idea. There are probably other good solutions too, interested in any ideas you might have. |
I will debug it a bit later today. And maybe we can also have a sync to try to write some more docs on how to use it. |
I am currently working on adjusting the React Query documentation under the 'Guides & concepts' menu by adding Angular examples and making changes here and there. After that I think I'll work on adding more examples, will be a lot of work so feel free to pick any of these. What I am currently thinking of adding:
|
…fields instead of query itself being a signal and improved types
The last commit introduces a proxy object (inspired by rx-angular rxState ) implementation. Basically, it converts the query signal to a query object that has signals fields (uses computed underneath) query = injectQuery();
// Before
query().data
query().isPending
// After
query.data()
query.isPending() Also, takes care of function calls, to not convert them into signals too 😅 |
Awesome work @eneajaho, really like your last commit with the proxy. |
You can see where I got the inspiration from 😄 rxState and rxActions do the same trick under the hood https://github.com/rx-angular/rx-angular/blob/main/libs/state/actions/src/lib/proxy.ts |
packages/angular-query-devtools-experimental/src/angular-query-devtools.component.ts
Show resolved
Hide resolved
Co-authored-by: Chau Tran <[email protected]>
Co-authored-by: Chau Tran <[email protected]>
fix(angular-query): improve development workflow
No description provided.