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: Extend connect-query-es to other Tanstack Query variants #324

Closed
MDr164 opened this issue Jan 16, 2024 · 9 comments
Closed

feat: Extend connect-query-es to other Tanstack Query variants #324

MDr164 opened this issue Jan 16, 2024 · 9 comments

Comments

@MDr164
Copy link

MDr164 commented Jan 16, 2024

Buf Slack link: https://bufbuild.slack.com/archives/CRZ680FUH/p1705412823808149

As discussed on Slack this issue shall track the initial addition of more than just the React variant of Tanstack Query. The v1 release already went ahead and decoupled the codegen from react but several more steps will be needed to fully implement compatibility with other variants. To quote @paul-sachs on the approach:

The first steps I’d recommend would be to create your own package that depends on connect-query and uses only the non-react specific apis (createConnectQueryKey and callUnaryMethod) and create your own version of useQuery based on that. As much as I think the apis are similar, I think the types (and use of suspense) are probably different. Once you figure out the common bits that your package needs, the first step for us would probably be to create a connect-query-core package that just exports those and we can work towards removing the unnecessary dependencies.

@MDr164
Copy link
Author

MDr164 commented Jan 25, 2024

Quick update on this, I was able to test a very rough Svelte implementation and using stores and context works in a similar manner than the react implementation of connect-query-es works. Should I create a standalone package as reference first, e.g. as a repo under my name which you guys can then integrate with your own ideas or should I create a PR directly to this repo with my own try to integrate it?

@paul-sachs
Copy link
Collaborator

Hey @MDr164, glad to hear it worked alright. I think the best way forward is to get your repo up and we can look to update our own repo to better support yours (by splitting out a core package). It may still make sense to integrate your repo back into this one eventually, but that depends on the amount of glue code.

@paul-sachs
Copy link
Collaborator

Once that progresses a little further and everyone is happy with the state of the repo, we can go ahead and get the repo added to the connectrpc org so it's all equally discoverable. The specific process is here.

@george-oakling
Copy link

What is the status of this? We would like to participate as we use Svelte extensively and this might solve some boilerplate for us :)

@MDr164
Copy link
Author

MDr164 commented Feb 12, 2024

I'll publish that PoC repo this week once I'm satisfied with amount of boilerplate aka keep it trimmed down a bit more. Side note: I built it around Svelte 4 so only with the Context and Store API

@george-oakling
Copy link

Hi, any news? Can we help?

@george-oakling
Copy link

Hi @MDr164 - would you like me to participate on this?

paul-sachs added a commit that referenced this issue Oct 31, 2024
A dedicated connect-query-core package makes it much easier to integrate
non-react integrations.

The public API of `@connectrpc/connect-query` hasn't changed at all, all
the same methods and types are exposed, we've just separated them into a
distinct package that gets reexported from `@connectrpc/connect-query`.

This change allows others to depend on connect-query without necessarily
depending on react and react-query.

Partially addresses #324

---------

Signed-off-by: Paul Sachs <[email protected]>
Co-authored-by: Timo Stamm <[email protected]>
@paul-sachs
Copy link
Collaborator

With V2 out (in RC) and the core package available, it should be pretty trivial to write adapters for different frameworks. Going to close this since there hasn't been any activity for a while.

@MDr164
Copy link
Author

MDr164 commented Nov 21, 2024

I'll give it another shot. We redesigned large parts to use websockets instead for what I initially used connect-query so I never got around polishing up the hacky solution I had. But with the new core package I'll retry and see where that goes. 👍

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

3 participants