connectrpc / connect-query-es

TypeScript-first expansion pack for TanStack Query that gives you Protobuf superpowers.
https://connectrpc.com/docs/web/query/getting-started
Apache License 2.0
218 stars 14 forks source link

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

Open MDr164 opened 7 months ago

MDr164 commented 7 months ago

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 commented 7 months ago

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 commented 7 months ago

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 commented 7 months ago

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 commented 6 months ago

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 commented 6 months ago

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 commented 6 months ago

Hi, any news? Can we help?

george-oakling commented 5 months ago

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