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

Tanstack Query queryOptions API #147

Open
oscartbeaumont opened this issue Nov 15, 2024 · 1 comment
Open

Tanstack Query queryOptions API #147

oscartbeaumont opened this issue Nov 15, 2024 · 1 comment

Comments

@oscartbeaumont
Copy link
Member

Add a Language implement that can something like:

export const commandOne = queryOptions({
   queryKey: [....] as const,
   queryFn: () => commands.someCommand()
})

So it could be used like createQuery(() => commandOne).

The queryOptions API allows spreading so we wouldn't allow configuring custom options, that would be on the end-user.

@oscartbeaumont
Copy link
Member Author

I wonder if we could wrap event listeners with the query options API too. Something like useQuery(() => myEventListener((event) => ...)) then the useQuery could tie into the React/Solid/etc lifecycle for cancellation.

This is a not really using useQuery how it's design but if it works it makes for better DX without the maintenance burndon of every framework.

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

No branches or pull requests

1 participant