-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Should warn when params are not provided #1572
Comments
This seems to be a bug indeed. But it has nothing to do with being nested or not. The point is that the router-link component doesn't seem to reactively re-render (even though $route is a reactive dependency) when the params in $route change in this example, or it does, but $route is somehow wrong? I'm not sure yet. It does only update in the <pre v-text="$route.params.nav"></pre> Comment out the above and that component's router-link doesn't change as well: http://jsfiddle.net/Linusborg/forzLu80/31/ A workaround would be to actually explicitly provide the |
|
@posva I agree on a philosophical level that it's better to always define required params explicitly, but technically I think this example should work nonetheless. So why is the router-link not updating, even though |
I think a warning would help a lot, as this does work in some cases. |
After diving a bit more on the repro, the problem comes from the fact that params that have the same name between current route and target route, are reused if not provided (plus what you explained about the component that re renders and therefore recompute the link). Which leads to another problem when two named routes have the same parameters like So here, the problem is that edit: actually, there's another problem as if the prop of the router-link was overwritten somewhere... |
@posva When hitting the bug I was trying to change the subnav while maintaining the mainnav parameter (I think, not sure anymore).
The main problem stays the same, though: Why the difference in the behaviour? In my understanding, current params and queryparams should be maintained when omitted and following a named route, right? |
That's actually different because in |
@posva Ok sorry for the confusion. I guess while trying out how to implement this, I stumbled upon the error. |
What? there's nothing to be sorry about! 😄 |
this bug,me submitted pr,Why did no one handle it |
This comment has been minimized.
This comment has been minimized.
Merging params will be kept so that users can provide partial params to navigate between children routes |
Version
2.7.0
Reproduction link
http://jsfiddle.net/forzLu80/30/
Steps to reproduce
What is expected?
Both
router-link
components should behave exactly the same as their data is equal.What is actually happening?
router-link
components in nested components behave differently when param values are updated.The text was updated successfully, but these errors were encountered: