Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

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

Merged
merged 2 commits into from Sep 16, 2022

Conversation

danielroe
Copy link
Member

@danielroe danielroe commented Sep 15, 2022

πŸ”— 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.

@danielroe danielroe 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 pi0 September 15, 2022 21:26
@danielroe danielroe self-assigned this Sep 15, 2022
@netlify
Copy link

netlify bot commented Sep 15, 2022

βœ… Deploy Preview for nuxt3-docs canceled.

Name Link
πŸ”¨ Latest commit 5a89c53
πŸ” Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/63243a11b004a80008f93f29

@pi0 pi0 changed the title fix(nuxt): apply data/state from cache immediately before route resolves fix(nuxt): load payload after middleware and once final route is resolved Sep 16, 2022
@pi0 pi0 merged commit c1ed6ec into main Sep 16, 2022
@pi0 pi0 deleted the fix/static-hotfix branch September 16, 2022 10:15
@pi0 pi0 mentioned this pull request Sep 20, 2022
@danielroe danielroe added the 3.x label Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3.x bug Something isn't working πŸ”¨ p3-minor-bug Priority 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.

None yet

2 participants