@@ -153,7 +153,7 @@ class Store {
153153
154154 hotUpdate ( newOptions ) {
155155 this . _modules . update ( newOptions )
156- resetStore ( this )
156+ resetStore ( this , true )
157157 }
158158
159159 _withCommit ( fn ) {
@@ -164,7 +164,7 @@ class Store {
164164 }
165165}
166166
167- function resetStore ( store ) {
167+ function resetStore ( store , hot ) {
168168 store . _actions = Object . create ( null )
169169 store . _mutations = Object . create ( null )
170170 store . _wrappedGetters = Object . create ( null )
@@ -173,10 +173,10 @@ function resetStore (store) {
173173 // init all modules
174174 installModule ( store , state , [ ] , store . _modules . root , true )
175175 // reset vm
176- resetStoreVM ( store , state )
176+ resetStoreVM ( store , state , hot )
177177}
178178
179- function resetStoreVM ( store , state ) {
179+ function resetStoreVM ( store , state , hot ) {
180180 const oldVm = store . _vm
181181
182182 // bind store public getters
@@ -209,11 +209,13 @@ function resetStoreVM (store, state) {
209209 }
210210
211211 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+ }
217219 Vue . nextTick ( ( ) => oldVm . $destroy ( ) )
218220 }
219221}
0 commit comments