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

beforeCreate/created lifecycle hooks aren't called (Vue 2 direct injection) #33

Open
thecodewarrior opened this issue Dec 7, 2021 · 1 comment

Comments

@thecodewarrior
Copy link

thecodewarrior commented Dec 7, 2021

As it is in #27 the created lifecycle hook isn't called. That's because that has to be present directly on the options object, and I don't explicitly add support for that. My thought is to go a route similar to vue-class-component where it just calls a method called created().

This isn't as much of an issue in Vue 3, since the object is reactive from the very beginning. In Vue 2 you can't do any vue/reactive operations (e.g. this.$watch) inside the constructor, which is why having a created lifecycle hook is useful.

@nebaughman
Copy link

It would be very helpful to have a created() hook method in @VueStore classes:

  • The constructor is not appropriate in some cases (as mentioned above)
  • Using created() has more symmetry with TypeScript Vue component classes (at least in Vue 2)

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