Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
vue-router current path invalid for a short time when loading async component #2703
Steps to reproduce
Using vue and vue-router, create a route that requires a component (componentAsync) that is async loaded from the main component (componentApp).
Do something that uses router.push or router.go inside of
The redirected route will just use path: '/' instead of the actual path you used to initially hit the page.
For example, if you hit
What is expected?
vue-router would use the current window location
What is actually happening?
vue-router is using /
This is because the async component makes the confirmTransaction callback take longer than the mounted() call to router.push, so the route inside router is still the one with the wrong path.
Thanks for the review. I disagree with the reasoning, as a developer, I would not want to have to think about additional criteria. I want to just be able to say $router.push(), not "Can I say $router.push yet, or do I need to wait for onReady"? This means potentially I need to wrap any $router.push inside of a onReady() if I want to be 100% safe, which just seems... lame. But, I understand that there are reasons beyond my understanding for your decision.
may as well actually reflect the real starting state (