Skip to content
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

webpack-dev-server Hello component msg update can not live update view #126

Closed
cnweibo opened this issue Jul 19, 2016 · 1 comment
Closed

Comments

@cnweibo
Copy link

cnweibo commented Jul 19, 2016

Hi, everything works perfectly when first setup vue webpack developement environment.
I open the http://localhost:8080 to check the live update when updating source code.

  1. When change template for both App and Hello, the view will update immediately;
  2. When i change msg data property of Hello, it does not update automatically, I must do a refresh;
    How can I fix it?

thanks~

@LinusBorg
Copy link
Member

LinusBorg commented Jul 19, 2016

You can't. It's a limitation of hot reloading.

It's even described in the source code of Hello.vue

// note: changing this line won't causes changes
// with hot-reload because the reloaded component
// preserves its current state and we are modifying
// its initial state.
msg: 'Hello World'

Because in components, initial state if defined as a function: data() { return ... }, which is executed when an instance of a component is created during rendering. Hot reloading cannot replace this dynamically created state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants