Skip to content

Commit a85c19a

Browse files
committed
allow partially hot reload modules
1 parent f07adca commit a85c19a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Diff for: src/index.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class Store {
133133
}
134134

135135
/**
136-
* Hot update actions and mutations.
136+
* Hot update mutations & modules.
137137
*
138138
* @param {Object} options
139139
* - {Object} [mutations]
@@ -163,13 +163,16 @@ class Store {
163163
* Bind mutations for each module to its sub tree and
164164
* merge them all into one final mutations map.
165165
*
166-
* @param {Object} modules
166+
* @param {Object} updatedModules
167167
*/
168168

169-
_setupModuleMutations (modules) {
170-
this._modules = modules
169+
_setupModuleMutations (updatedModules) {
170+
const modules = this._modules
171171
const { getPath } = Vue.parsers.path
172172
const allMutations = [this._rootMutations]
173+
Object.keys(updatedModules).forEach(key => {
174+
modules[key] = updatedModules[key]
175+
})
173176
Object.keys(modules).forEach(key => {
174177
const module = modules[key]
175178
if (!module || !module.mutations) return

0 commit comments

Comments
 (0)