-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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): reuse page component on watchQuery #5757
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #5757 +/- ##
=========================================
- Coverage 95.64% 95.6% -0.04%
=========================================
Files 82 82
Lines 2662 2662
Branches 683 683
=========================================
- Hits 2546 2545 -1
- Misses 97 98 +1
Partials 19 19
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## dev #5757 +/- ##
=====================================
Coverage 95.6% 95.6%
=====================================
Files 82 82
Lines 2662 2662
Branches 683 683
=====================================
Hits 2545 2545
Misses 98 98
Partials 19 19
Continue to review full report at Codecov.
|
Documentation also needs to be reverted 😄 |
I've submitted a pull request on docs too. |
Types of changes
Description
Related issue and pull request:
key()
after #5516 #5759watchQuery
option inrouterViewKey
#5516I've submitted the pull request #5516 and it's about making
watchQuery
considered on creating a route key. However, by the change, page components are no more reused but recreated for every query route specified inwatchQuery
(#5738). The pull request was actually a breaking change.The main goal of the original pull request was to make scroll restoration work with query route. Disabling component reuse is unexpected side-effect. Thus I'd like to revert the original change, with still enabling scroll restoration in a different way. So, here is this pull request.
This pull request restores the original
routerViewKey
behaviour ($route.path
) so that page components are reused. Instead, I added$emit('triggerScroll')
infixPrepatch
, which is called only whennavigating on a different route but the same component is used
according to the function's comment. I tested the change out on example pages and it worked well. The original test cases on scroll behaviour pass too.Because of this change the documentation about
routerViewKey
should be updated (watchQuery
no more affects the key). I'll update it and upload a pull request on docs after this pull request is reviewed.Thanks in advance!
Checklist: