Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
/frameworkPublic archive

fix(nuxt): load payload after middleware and once final route is resolved - #7574

Merged
pi0 merged 2 commits into
mainfrom
fix/static-hotfix
Sep 16, 2022
Merged

fix(nuxt): load payload after middleware and once final route is resolved#7574
pi0 merged 2 commits into
mainfrom
fix/static-hotfix

Conversation

@danielroe

@danielroedanielroe commented Sep 15, 2022

Copy link
Copy Markdown
Member

🔗 Linked issue

nuxt/nuxt#14927

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

This is not an alternative to #7567, but a separate fix. It ensures the data is only applied immediately before the route resolves (so after all middleware have been processed - and not when the data is prefetched)....

Where same asyncData keys are used for different routes (e.g. in a [slug].vue), this will resolve the issue, with one exception: if there are still additional async setups required and the keys collide.

In some ways this mitigates nuxt/nuxt#14927 because data isn't overwritten when it is prefetched, but only when the route is changed.


Note: although it hotfixes content + prerender, we still would want to change content implementation as suspense doesn't work when swapping data out like this; instead, we want a route-based composable so that we can have two 'trees'. (useState doesn't work best when holding route-based data because it isn't naturally associated with a route... See nuxt/nuxt#14924.)

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroedanielroe added bug Something isn't working 🔨 p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage labels Sep 15, 2022
@danielroe
danielroe requested a review from pi0September 15, 2022 21:26
@danielroedanielroe self-assigned this Sep 15, 2022
@netlify

netlifyBot commented Sep 15, 2022

Copy link
Copy Markdown

Deploy Preview for nuxt3-docs canceled.

NameLink
🔨 Latest commit5a89c53
🔍 Latest deploy loghttps://app.netlify.com/sites/nuxt3-docs/deploys/63243a11b004a80008f93f29

@pi0pi0 changed the title fix(nuxt): apply data/state from cache immediately before route resolvesfix(nuxt): load payload after middleware and once final route is resolvedSep 16, 2022
pi0
pi0 approved these changes Sep 16, 2022
@pi0
pi0 merged commit c1ed6ec into mainSep 16, 2022
@pi0
pi0 deleted the fix/static-hotfix branch September 16, 2022 10:15
@pi0pi0 mentioned this pull request Sep 20, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

3.xbugSomething isn't working🔨 p3-minor-bugPriority 3: a bug in an edge case that only affects very specific usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@danielroe@pi0