@@ -30,8 +30,6 @@ export function resetStore (store, hot) {
30
30
export function resetStoreState ( store , state , hot ) {
31
31
const oldState = store . _state
32
32
const oldScope = store . _scope
33
- const oldCache = store . _computedCache
34
- const oldGettersKeySet = new Set ( store . getters ? Object . keys ( store . getters ) : [ ] )
35
33
36
34
// bind store public getters
37
35
store . getters = { }
@@ -47,10 +45,6 @@ export function resetStoreState (store, state, hot) {
47
45
48
46
scope . run ( ( ) => {
49
47
forEachValue ( wrappedGetters , ( fn , key ) => {
50
- // Filter stale getters' key by comparing oldGetters and wrappedGetters,
51
- // the key does not be removed from oldGettersKeySet are the key of stale computed cache.
52
- // Stale computed cache: the computed cache should be removed as the corresponding module is removed.
53
- oldGettersKeySet . delete ( key )
54
48
// use computed to leverage its lazy-caching mechanism
55
49
// direct inline function use will lead to closure preserving oldState.
56
50
// using partial to return function with only arguments preserved in closure environment.
@@ -70,7 +64,6 @@ export function resetStoreState (store, state, hot) {
70
64
// register the newly created effect scope to the store so that we can
71
65
// dispose the effects when this method runs again in the future.
72
66
store . _scope = scope
73
- store . _computedCache = computedCache
74
67
75
68
// enable strict mode for new state
76
69
if ( store . strict ) {
@@ -89,24 +82,6 @@ export function resetStoreState (store, state, hot) {
89
82
90
83
// dispose previously registered effect scope if there is one.
91
84
if ( oldScope ) {
92
- const deadEffects = [ ]
93
- const staleComputedCache = new Set ( )
94
- oldGettersKeySet . forEach ( ( staleKey ) => {
95
- staleComputedCache . add ( oldCache [ staleKey ] )
96
- } )
97
- oldScope . effects . forEach ( effect => {
98
- // Use the staleComputedCache match the computed property of reactiveEffect,
99
- // to specify the stale cache
100
- if ( effect . deps . length && ! staleComputedCache . has ( effect . computed ) ) {
101
- // Merge the effect that already have dependencies and prevent from being killed.
102
- scope . effects . push ( effect )
103
- } else {
104
- // Collect the dead effects.
105
- deadEffects . push ( effect )
106
- }
107
- } )
108
- // Dispose the dead effects.
109
- oldScope . effects = deadEffects
110
85
oldScope . stop ( )
111
86
}
112
87
}
0 commit comments