Skip to content
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

routeRules static with NuxtLink not working correctly #15580

Closed
AscaL opened this issue Nov 22, 2022 · 4 comments
Closed

routeRules static with NuxtLink not working correctly #15580

AscaL opened this issue Nov 22, 2022 · 4 comments

Comments

@AscaL
Copy link

AscaL commented Nov 22, 2022

Environment


  • Operating System: Windows_NT
  • Node Version: v16.17.0
  • Nuxt Version: 3.0.0
  • Nitro Version: 1.0.0
  • Package Manager: pnpm@7.14.2
  • Builder: vite
  • User Config: routeRules
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://github.com/AscaL/nuxt-rendering/tree/28e735a75b3cb0e564e513cd237d42767d0ac779 (not working)

https://github.com/AscaL/nuxt-rendering/tree/84d2ddce6560e899f709308a6460954a3a502d7a (working)

Describe the bug

I have the root page set up with 3 NuxtLink that point to /static, /swr and /ssr with the following rules:
image

on each page i await useFetch('https://worldtimeapi.org/api/ip') to get a time.

after uploading to netlify, the /static page shows the correct (cached version) on refresh, but entering it via a NuxtLink from the root /, runs the fetch getting me my current time. If i then refresh the page i get the correct cached version.
By replacing the NuxtLink with an <a> it works as intended.

Additional context

No response

Logs

No response

@ndragun92
Copy link

The same is happening to me. Not sure if that is intended or not. But feels weird to get new data on nuxt link navigation and then on refresh get cached one. Could confuse the user in case he navigates on the site and then refreshes a page...
In that case, he could see two different contents.

@idflood
Copy link
Contributor

idflood commented Dec 15, 2022

I got the same behaviour with a full static website. On navigation there are backend calls but on page refresh it correctly load the payload.

Also the payload get preloaded but are not really used when clicking on NuxtLinks.

I created an issue on nuxt-graphql-client but maybe this is more of a nuxt issue: Diizzayy/nuxt-graphql-client#276

edit: probably related to nuxt/framework#8885

@danielroe
Copy link
Member

You need to have experimental.payloadExtraction enabled if you are running nuxt build.

@idflood
Copy link
Contributor

idflood commented Dec 20, 2022

My issue was related to inconsistent slug handling in my catchall page, and probably different and/or wrong response from the graphql backend.

After making sure the "full slug" has leading and trailing slashes the static site generation is working as expected.

@danielroe danielroe closed this as not planned Won't fix, can't repro, duplicate, stale Dec 20, 2022
@danielroe danielroe added the 3.x label Jan 19, 2023
@danielroe danielroe transferred this issue from nuxt/framework Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants