fix: move auto installation code into the store constructor #914
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While auto-calling
Vue.use(Vuex)
is convenient for users who use Vue/Vuex via<script>
, there are a case that users want to avoid the behavior whenwindow.Vue
is exists (See #731).Currently, Vuex is immediately installed into
window.Vue
when Vuex is imported. So there are no way to install Vuex intoimport
ed Vue.To solve this, I'd move it in
Vuex.Store
's constructor. Then the auto-installation is delayed until users create a store and the users can install Vuex into their own Vue constructor before doing it.I'm not sure how to write test code for this but it looks like working well.
fix #731