fix(nuxt): track suspense status so we can share single state#7400
fix(nuxt): track suspense status so we can share single state#7400
Conversation
✅ Deploy Preview for nuxt3-docs canceled.
|
|
(added pending to land after RC.10) |
247e18b to
c98e5c7
Compare
|
@danielroe Would you please help to resolve conflicts? Will do a quick test afterwards to merge 🚀 |
|
Sure 👍 I am also working on resolving nuxt/nuxt#14573, which may touch some of these files too, but I think this is safe to merge and we can iterate. |
|
Isn't change of suspense wrapper one of the reason that page loaded twice? https://stackblitz.com/edit/github-fktkzl-zxyvww?file=src%2FApp.vue I don't think vue can keep the page instance if the wrapper changed. |
|
@mmis1000 Yes, it is, and nuxt/nuxt#14573 exists to track it. I don't believe it's affected by this PR; please let me know if you think otherwise. |
I think use of any additional reactive property that does not change at the same time of route in the render function of NuxtPage component is a entirely bad idea. (Just like in this PR, which introduced more reactive state.). Because any structure change of parent of page component WILL RELOAD the whole page. |
|
This PR deliberately doesn't make it reactive. So it should only change the suspense structure if there is already a rerender happening. |
https://stackblitz.com/edit/github-gagmal-vjqqo3?file=pages%2Fb%2F[id].vue That line alone is already enough to cause bug.
|
|
You're right, it does cause an unnecessary rerender. We may pend this PR as I have local work-in-progress that doesn't cause it, and it makes sense to resolve nuxt/nuxt#14573 at the same time. |
|
I think one of potential fix would be using a counter to count how many By the way, is the |
5bc212c to
f614099
Compare
🔗 Linked issue
resolves nuxt/nuxt#14839
❓ Type of change
📚 Description
This PR:
isHydratingwasfalsein nested child pages on initial load (which has bad consequences for data fetching, as we make decisions based on whether it's the first load or not).<NuxtLayout>) meaning thatisHydratingis incorrectly false for these entire trees.📝 Checklist