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

navigateTo in statically generated site #27813

Closed
captenmasin opened this issue Jun 25, 2024 · 1 comment
Closed

navigateTo in statically generated site #27813

captenmasin opened this issue Jun 25, 2024 · 1 comment

Comments

@captenmasin
Copy link

Environment

  • Operating System: Linux
  • Node Version: v18.17.1
  • Nuxt Version: 3.0.0
  • Nitro Version: 1.0.0
  • Package Manager: npm@9.6.7
  • Builder: vite
  • User Config: dev, ssr, target, css, plugins, modules, devtools, head, hooks, nitro, experimental, alias
  • Runtime Modules: @sidebase/nuxt-pdf@0.1.1, nuxt-pdfmake@0.0.14
  • Build Modules: -

Reproduction

A basic nuxt app with 2 pages, both getting data from an API with one of those pages have a link to the other via navigateTo

Describe the bug

A basic nuxt app with 2 pages, both getting data from an API via:

const route = useRoute();
const { data: page } = await useAsyncData(
	'page', () => fetch(`${this.baseUrl}/by-path/${route.path}`);
);

One page uses navigateTo to link to the second page

Generating flat HTML via npm run generate means that no API call is made when visiting either page. When clicking the navigateTo link on page one to page two, page 2 calls the API as if it is not statically generated

Additional context

No response

Logs

No response

@manniL
Copy link
Member

manniL commented Jun 25, 2024

This is correct behavior. If no payload is extracted/available, useAsyncData (and useFetch) will fall back to client-side fetching.

@manniL manniL closed this as not planned Won't fix, can't repro, duplicate, stale Jun 25, 2024
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

2 participants