Skip to content

Cannot register Vuex in created hooks with performance on. #5209

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

Closed
SawyerHopkins opened this issue Mar 16, 2017 · 1 comment
Closed

Cannot register Vuex in created hooks with performance on. #5209

SawyerHopkins opened this issue Mar 16, 2017 · 1 comment
Labels

Comments

@SawyerHopkins
Copy link

Vue.js version

2.2.4

Reproduction Link

https://jsfiddle.net/1o3hj0ca/

On line 20 change the Vue.config.performance from true to false to switch between normal behavior and the issue behavior.

Steps to reproduce

Attempting to register a Vuex module in a beforeCreate or created hook, with the performance option set to true, will prevent Vue from rendering.

What is Expected?

If the fiddle executes correctly the following text should be displayed.

Hello from default module
Hello from registered module

What is actually happening?

Uncaught DOMException: Failed to execute 'measure' on 'Performance': The mark 'vue-perf-init' does not exist.

TypeError: Cannot read property '$options' of undefined

Other

Some quick messing about I've found that this bug was introduced sometime after 2.2.1.

@SawyerHopkins
Copy link
Author

I tracked this down to there being multiple instances of a vue-perf-init mark. It seems like the rest of the lifecycle adds the vm uid as a suffix to the performance tag. Implementing this into the init process appears to fix this issue. https://github.com/SawyerHopkins/vue/commit/ddbdaa05dd21c321f2d53887d7b5905276ad2079

awamwang added a commit to awamwang/vue that referenced this issue Mar 17, 2017
* 'dev' of https://github.com/vuejs/vue:
  remove env vars from npm scripts
  also catch error in data() (close vuejs#5198)
  always use uid when calling performance.mark (fix vuejs#5209)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants