@@ -56,7 +56,7 @@ export default function createStoreInternals({
56
56
const defaultState = initialState || { } ;
57
57
let selectorId = 0 ;
58
58
59
- const computedProperties = { } ;
59
+ const computedProperties = [ ] ;
60
60
61
61
const actionCreatorDict = { } ;
62
62
const actionCreators = { } ;
@@ -203,7 +203,7 @@ export default function createStoreInternals({
203
203
} ) ;
204
204
} ;
205
205
createComputedProperty ( target ) ;
206
- set ( path , computedProperties , createComputedProperty ) ;
206
+ computedProperties . push ( { key , parentPath , createComputedProperty } ) ;
207
207
} else if ( value [ selectorSymbol ] ) {
208
208
selectorId += 1 ;
209
209
const selectorInstanceId = selectorId ;
@@ -559,17 +559,11 @@ export default function createStoreInternals({
559
559
: stateAfterCustomReducers ;
560
560
const result = selectorsReducer ( stateAfterSelect ) ;
561
561
isInReducer = false ;
562
- const recursiveRebindComputedProperties = ( currentPath , obj ) => {
563
- const updatedCurrent = get ( currentPath , result ) ;
564
- Object . keys ( obj ) . forEach ( key => {
565
- if ( typeof obj [ key ] === 'function' ) {
566
- obj [ key ] ( updatedCurrent ) ;
567
- } else {
568
- recursiveRebindComputedProperties ( [ ...currentPath , key ] , obj [ key ] ) ;
569
- }
562
+ if ( result !== state ) {
563
+ computedProperties . forEach ( ( { parentPath, createComputedProperty } ) => {
564
+ createComputedProperty ( get ( parentPath , result ) ) ;
570
565
} ) ;
571
- } ;
572
- recursiveRebindComputedProperties ( [ ] , computedProperties ) ;
566
+ }
573
567
return result ;
574
568
} ;
575
569
0 commit comments