-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
fix(vue-app): prevent double layout execution (#5703) #7442
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #7442 +/- ##
=======================================
Coverage 70.32% 70.32%
=======================================
Files 88 88
Lines 3704 3704
Branches 1010 1010
=======================================
Hits 2605 2605
Misses 892 892
Partials 207 207
Continue to review full report at Codecov.
|
Also reported in #7441. |
Does this change influence page transitions? Did you check manually? Dont think we have proper tests to make sure they perform well visually? But Im worried that this might be a breaking change (albeit it probably a low risk one). If a user already adds their own beforeResolve hook and cancels navigation (or redirects) within that, then the new/wrong layout will already be set. |
I did test manually, seems ok. Re: |
@pimlie turns out we can use |
🎉🎉 |
Great!! Good job. @Atinux Can I pull this fix in through nuxt-edge or how can I get this fix in my application? |
@simplenotezy |
I see, thanks @pi0 |
I can confirm it's working on my end. Good job guys |
For me its not page but all page components are mounting twice. Tried Nuxt 2.13 and 2.14 and edge (2.15) but having the same issue everywhere. Please is there any fix for this? https://streamable.com/n5m3y6 ---> Check the fix on this screen recording, but it would be great if someone could explain this!? After removing that commented line the components are not mounting twice anymore 😅 |
In vue-app/client.js, we use
showNextPage()
to set layout, which is ran in anafterEach
hook. As reported in #5703, this causes a double execution when switching layouts. Perhaps having this occur inafterEach
is not fast enough -- switching tobeforeResolve
seems to solve it.Update: using
afterEach
works, but the actual call must happen beforenextTick
.