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

Type Error while hot reloading #10721

Open
SimonSiefke opened this issue Oct 16, 2019 · 1 comment
Open

Type Error while hot reloading #10721

SimonSiefke opened this issue Oct 16, 2019 · 1 comment

Comments

@SimonSiefke
Copy link

Version

2.6.10

Reproduction link

https://github.com/SimonSiefke/vue-hot-reloading-issue

Steps to reproduce

Inside the script section inside App.vue, do the following edits:

  1. remove the return inside data
export default {
    data() { }
};
  1. return an empty object
export default {
  data() {
    return {};
  }
};
  1. return the original
export default {
  data() {
    return {
      count: 2
    };
  }
};

What is expected?

After doing the edits, the App looks normal since it is the same code as before.

What is actually happening?

Hot reloading encounters multiple TypeErrors inside updateComponent from Vue and the App cannot recover from its state and doesn't update automatically anymore, it just shows a blank page.

Also, the command line shows DONE Compiled successfully in 97ms which suggests that everything is fine.

When the page is reloaded everything works again as expected.


Additional Information:

I have included images inside the minimal reproduction sample that might be useful.

@SimonSiefke
Copy link
Author

The TypeErrors are happening in the following places:

  1. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data))

target.$data is undefined, therefore we get TypeError: right-hand side of 'in' should be an object, got undefined

  1. if (key in target.$data) warnReservedPrefix(target, key)

basically the same as 1.

  1. if (vm._data.__ob__) {

    vm.data is undefined, therefore we get TypeError: "vm._data is undefined"

SimonSiefke added a commit to SimonSiefke/vue that referenced this issue Oct 16, 2019
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

1 participant