-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Prevent $route
updating deactivated components when using keep-alive
#2739
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
Comments
Duplicate of vuejs/vue#8819 |
Update: There are a few practices which seem to prevent the component from updating when using vue-router:
|
So, router-link and route props are implemented in such a way which don't cause the component to update. Can't we do the same with the rest, ie. |
You can always wrap the const SolidRouterView = Vue.extend({
render(h) {
return h('router-view')
}
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
What problem does this feature solve?
When wrapping
router-view
insidekeep-alive
, the components which are kept alive, keep updating on every route change, if they depend on any$route
properties like$route.name
or$route.params
.This kinda defeats the purpose of keep-alive, because even though kept-alive components are not remounted, they update in every route change, even while they are deactivated.
What does the proposed API look like?
The default behavior should be that $route only causes the component to update if the component has been activated.
The text was updated successfully, but these errors were encountered: