@@ -153,7 +153,7 @@ class Store {
153
153
154
154
hotUpdate ( newOptions ) {
155
155
this . _modules . update ( newOptions )
156
- resetStore ( this )
156
+ resetStore ( this , true )
157
157
}
158
158
159
159
_withCommit ( fn ) {
@@ -164,7 +164,7 @@ class Store {
164
164
}
165
165
}
166
166
167
- function resetStore ( store ) {
167
+ function resetStore ( store , hot ) {
168
168
store . _actions = Object . create ( null )
169
169
store . _mutations = Object . create ( null )
170
170
store . _wrappedGetters = Object . create ( null )
@@ -173,10 +173,10 @@ function resetStore (store) {
173
173
// init all modules
174
174
installModule ( store , state , [ ] , store . _modules . root , true )
175
175
// reset vm
176
- resetStoreVM ( store , state )
176
+ resetStoreVM ( store , state , hot )
177
177
}
178
178
179
- function resetStoreVM ( store , state ) {
179
+ function resetStoreVM ( store , state , hot ) {
180
180
const oldVm = store . _vm
181
181
182
182
// bind store public getters
@@ -209,11 +209,13 @@ function resetStoreVM (store, state) {
209
209
}
210
210
211
211
if ( oldVm ) {
212
- // dispatch changes in all subscribed watchers
213
- // to force getter re-evaluation.
214
- store . _withCommit ( ( ) => {
215
- oldVm . state = null
216
- } )
212
+ if ( hot ) {
213
+ // dispatch changes in all subscribed watchers
214
+ // to force getter re-evaluation for hot reloading.
215
+ store . _withCommit ( ( ) => {
216
+ oldVm . state = null
217
+ } )
218
+ }
217
219
Vue . nextTick ( ( ) => oldVm . $destroy ( ) )
218
220
}
219
221
}
0 commit comments