-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
Provide fetch key as an optional parameter to useAsyncGql composable #210
Comments
I am currently taking a deep dive into how SSG and Data fetching in Nuxt 3 works 'under the hood'. I took a look into the Nuxt source code and in asyncData.ts I found this:
Doesn't this mean, that this should be handled by Nuxt? Two calls with identical keys are no problem, because only one gets sent and the second time only the payload is returned? Sorry if these are dumb questions. I'm still trying to figure a lot of this stuff out. |
@DenFin Apologies for the incredibly late response here.
There is certainly merit in allowing the keys to be managed manually.
I've attempted to reproduce the behavior you've described to no avail, A second call to
Not quite, the code you referenced applies both to auto generated keys as well as keys manually passed to @DenFin Also if this is an issue that your still facing, I'd love to hear more about it as well as have an even closer look at your use case to come to a proper solution. |
@Diizzayy No worries, and thanks for your reply! We solved the issue by going back to use the client with the auto-generated functions and passing in custom fetch keys. Maybe I can set up a minimal reproduction of the issue. For now, it works. Thanks again for your reply! |
Hi @Diizzayy ,
We are using the client to fetch data from Contentful in Nuxt's static mode. As soon as we have an entry twice on a page we get an empty/white page. When we deactivate Javascript in the browser and reload the page, the static HTMl is there and has all the data. It seems like the Javascript hydrates an empty data object into the DOM.
It seems like the problem occurs because there are two calls with the same fetch key.
We thought it would be good to provide a fetch key as a third parameter for the
useAsyncGql
composable. What's your opinion on that?And I was wondering if it would be possible to handle the case where there are two calls with the same fetch key. The desired behaviour would be to prevent sending to seperate calls but instead use the data from the first call.
The text was updated successfully, but these errors were encountered: