Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

[Feature Request] Batch Queries #22

Open
rallisf1 opened this issue Jan 26, 2022 · 1 comment
Open

[Feature Request] Batch Queries #22

rallisf1 opened this issue Jan 26, 2022 · 1 comment

Comments

@rallisf1
Copy link

So, I have a usecase where I load multiple components on my site and I had a query for each of them, but soon I realised that even though sveltekit caches the responses, the http requests were still being made and the client had to wait for like 7-8 requests upon each page navigation.

I then merged most of the queries and now only 2 requests happen on each route (1 for the components and 1 for the page content) and things are a lot better. What I noticed though on my backend is that it supports batch queries and also provides a link on apollo's documentation on how it is implemented: https://www.wpgraphql.com/docs/wpgraphql-vs-wp-rest-api/#batch-queries

As I said, 2 requests per route are fine by me and I know this is a small project and chances of implementing any new features are slim, but here it is :D

P.S. Thanks for this lib, it's actually the most painless graphql client anyone can use with sveltekit atm.
P.S.2. Just editing gFetch to support multiple queries won't cut it I'm afraid as I am fetching the components query in my main __layout, since they are common to most routes.

@stolinski
Copy link
Contributor

Yeah so this does support batched as you mentioned in the PS2, but I'm not sure the best way to implement that into the codegen side of things.

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

No branches or pull requests

2 participants