nuxt / framework

Old repo of Nuxt 3 framework, now on nuxt/nuxt
https://nuxt.com
10.64k stars 1.05k forks source link

feat(nuxt): prefetch middleware/layouts + await layout loading #10155

Closed atinux closed 1 year ago

atinux commented 1 year ago

❓ Type of change

📚 Description

Hooked into link:prefetch to prefetch the layouts and middleware :rocket:

I also forced thge prefetching of layout on route navigation (not needed to depend on Suspense) like I did on Nuxt 2, this way we don't change the page until the layout if fully resolved.

Before (slow 3g):

https://user-images.githubusercontent.com/904724/213266458-6774d029-1e55-4e2d-9dd8-e72fbfd5ae26.mp4

After (slow 3g):

https://user-images.githubusercontent.com/904724/213266476-e2e5486d-9a67-4de5-a7d4-1f4c861200f7.mp4

codesandbox[bot] commented 1 year ago

CodeSandbox logoCodeSandbox logo  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

Luffyyy commented 1 year ago

I don't know if it's related, but this looks similar https://github.com/nuxt/nuxt.js/issues/14860 just with nested routes instead of layouts and it's been like this for a while. Could you check if this pull fixes it or address it in general?

danielroe commented 1 year ago

Testing on edge would be very welcome @Luffyyy 🙏