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

BeforeRouteEnter hook executes mounted hook #2563

Rolanddoda opened this Issue Dec 31, 2018 · 1 comment


None yet
2 participants
Copy link

Rolanddoda commented Dec 31, 2018



Reproduction link

Steps to reproduce

In the sandbox go to /about manually.

What is expected?

The mounted hook should not be executed.

What is actually happening?

If you open the console you can see that mounted hook gets executed.

I don't know if this is made by design, but since beforeRouteEnter runs before the component gets mount, the mounted hook should not be executed if from beforeRouteEnter hook you redirect to another path. It seems like a bug to me.


This comment has been minimized.

Copy link

posva commented Dec 31, 2018

The callback passed to next gets executed after mounted. This is by design.
BTW, you can probably extract the code to a method and call the method in the next callback :)
Also, don't pass artificial params that have not been declared as props. This has never been supported and we do not plan on supporting local state on navigations

@posva posva closed this Dec 31, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment