vishalbalaji / trpc-svelte-query-adapter

A simple adapter to use `@tanstack/svelte-query` with trpc, similar to `@trpc/react-query`.
71 stars 6 forks source link

Infinite queries? #9

Closed qudo-code closed 1 year ago

qudo-code commented 1 year ago

Hello, is it possible to to this pattern with this package? It seems like all input to trpcWithQuery goes to the endpoint and not to setup the query as seen here. Screenshot 2023-03-09 at 7 57 47 PM

qudo-code commented 1 year ago

https://tanstack.com/query/latest/docs/svelte/examples/svelte/load-more-infinite-scroll

qudo-code commented 1 year ago

Screenshot 2023-03-09 at 8 12 11 PM Screenshot 2023-03-09 at 8 12 26 PM

Notice I can createQuery but not createInfiniteQuery.

vishalbalaji commented 1 year ago

It is possible to do so. According to https://trpc.io/docs/useInfiniteQuery, your procedure would need to take in an optional param called cursor, which should show you createInfiniteQuery in your autocomplete.

I am assuming that this is the issue. If not, could you please share what the procedure looks like in the router for me to look into?

qudo-code commented 1 year ago

Yeah, I am assuming this is the issue as well, feel free to close this. Thanks for that.

vishalbalaji commented 1 year ago

Okay then, closing.