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

Ensure menu data is re-used across requests #128

Closed
fago opened this issue Mar 7, 2023 · 3 comments
Closed

Ensure menu data is re-used across requests #128

fago opened this issue Mar 7, 2023 · 3 comments
Labels

Comments

@fago
Copy link
Contributor

fago commented Mar 7, 2023

After first-page load, the menu data is available, e.g. due to state-hydration.
When navigating around pages, the menu data should not be re-fetched (unless language changes later on)

@TurtlBbx
Copy link
Contributor

TurtlBbx commented Mar 8, 2023

Cache support for useFetch/useAsyncData is not supported internally/out-of-the-box in Nuxt at the moment, as you can see in this open issue: nuxt/nuxt#15445.

Solutions:

  • We could implement a custom cache logic, but that's not ideal.
  • Solve it on project level, we could move menu components inside app.vue in projects, that way menus wouldn't get re-fetched on client side navigation and would need to be manually re-fetched when needed (e.g. language change). That would mean that we have menus on top level - app.vue, but we can also render menus inside different layouts (NuxtLayout) with named slots, so there shouldn't be any downside.

@TurtlBbx TurtlBbx added the 2.x label Mar 8, 2023
@fago
Copy link
Contributor Author

fago commented Mar 8, 2023

@TurtlBbx what about keepalive? https://vuejs.org/guide/built-ins/keep-alive.html

@fago
Copy link
Contributor Author

fago commented Mar 9, 2023

@TurtlBbx this is actually fixed by having the component in the layout
drunomics/lupus-decoupled-nuxt3-demo@f54c448

moving breadcrumbs in the layout breaks things though, a new bug.

@fago fago closed this as completed Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants