VueRouter beforeRouteEnter hook data changes are not reloaded
See original GitHub issueHi,
thanks for your work on hot reload!
I’m using vue-hot-reload-api implicitly with webpack dev server and vue-loader. When introducing vue-router into the mix and declaring a beforeRequestEnter hook, hot reloading does not work.
Expected behaviour
Hot reloading should reload data set by vue-routers beforeRequestEnter hook as well.
Actual behaviour
The beforeRequestEnter hook is executed, but the data set on the instance is not reloaded.
Steps to reproduce
Clone https://github.com/stoically/vue-router-hot-reload-issue (based on vue init webpack-simple
)
npm install
npm run dev
Navigate to http://localhost:8080
You’ll see Message from VueRouter: beforeRouteEnter
Now make a change in the src/Router.vue
file
Message changes to Message from VueRouter: data
Notes
I’m actually not sure if this is expected behaviour. But if it is I would appreciate any pointers on how to achieve hot reloading in this case manually.
Best regards
Issue Analytics
- State:
- Created 6 years ago
- Reactions:26
- Comments:7
Top GitHub Comments
I’m also having this issue where all my routes fetch data in the
beforeRouteEnter
hook as prescribed in the router docs , however this hook is not fired by hot-reload and all data are removed from the component, forcing me to do a full manual reload of the page.Will the router hooks be supported by hot-reload or are we left with
cmd+r
for the unforeseeable future?Be cool to get attention on this issue. Guess i have to forgo HMR for now.