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

feat: using @tanstack/react-query #146

Open
dalechyn opened this issue Feb 16, 2024 · 0 comments
Open

feat: using @tanstack/react-query #146

dalechyn opened this issue Feb 16, 2024 · 0 comments
Labels

Comments

@dalechyn
Copy link
Collaborator

What is the feature you would like to implement?
Hooks in auth-kit are managing query/mutations states themselves, yet it would be much more reliant to have them cached and managed by @tanstack/react-query.

Why is this feature important?
Library-independent state management is tough and increases the overall codebase complexity, along with caveat cases that are already managed by @tanstack/react-query.

Here's an example:
I have two components, one is a button that creates a channel, and the other one is a UI element that states wether a channel is created or not.

In order to implement one right now, I would have to implement a HOC that would use useCreateChannel and I'd need to propagate the state and mutation callback via props to my two components.

If this library leveraged @tanstack/react-query, I'd be able to call the hook separately in each component, and as long as the inputs are the same, I'd have the same state from react query cache.

How should this feature be built? (optional)
Just need to refactor anything that defines isSuccess, isError, state finality callback handlers, queries or mutations and such to use @tanstack/react-uqery.

Additional context
Developers using auth-kit would have to define their own QueryClient, which they already do with wagmi@2.0.0, so likelihood they've done it already is pretty high.

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

Successfully merging a pull request may close this issue.

1 participant