-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
[react-hooks] invalidate / setQueryData Helpers Without Query? #336
Comments
Hello, we have a typesafe way to get the queryKey : http://www.zodios.org/docs/client/react#zodios-key-helpers |
@ecyrbe Hi, We can get the query key currently, BUT:
With above approach we can have truly typesafe cache operations
I think the above trpc-like approach is just better. Selfishly I'm wanting to use your library on an upcoming project and would love to just have the type safe cache operations and not have to touch the query keys. Thanks for your work on this, this library is really impressive 😊 |
You convinced me. reopening. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
this would be awesome! |
Hello @robotkutya, |
Right now it seems like the invalidate helper is only returned from the
useQuery
hook, which I think can make it a little clunky in situations where you need to invalidate the query from a component that doesn't necessarily want to call the query. I think you'd have to do this (or manually dogetQueryKey
stuff):Any desire to have an way to invalidate / set query data in a typesafe way without needing to subscribe to the query or manually get the query keys and pass them? Something like:
This provides a really awesome DX
I'd be happy to dig into this if it sounds like something you'd want to have in the library @ecyrbe
The text was updated successfully, but these errors were encountered: