Nuxt Generate | Pages are re-fecthing data? #503
Unanswered
valeriosillari
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
set a simple side project with nuxt3 application with nuxt-graphql-client.
all fine: locally fine. build is fine. generate is fine.
Deployed on Vercel.
But ...
I got dynamic pages (Nuxt Dynamic pages) for some pages (3/4 of them, not so many) and a query on graphQL, to get simple data as Title, Description Text, Image.
const { data } = await useAsyncGql({ operation: 'page', // here just set as variables limit and an identifier to "catch" right page variables: gql_query_vars, })
Nuxt generate command creates static pages and I got also all data set as payload.json file.
Page at first load all code served statically >> No API calls. (GOOD)
But when I navigate thourh pages (from page "about" to page "contacts", same Nuxt Page code) i've noticed GraphQL query is called and API call is occurring. is this ok?
I guess at generate graphQL query should be called only on "generate" to create all static code and payload files. then never again.
Am I doing something wrong?
Did I miss some basic concept on GraphQL logic or Nuxt?
I set already some Nuxt Application as Full static and fetch data by an REST Api, never got issues.
So I guess the problem is more related to GraphQL and how I set all Query logic.
Any tips here? :)
Beta Was this translation helpful? Give feedback.
All reactions