File tree Expand file tree Collapse file tree 2 files changed +18
-12
lines changed
Expand file tree Collapse file tree 2 files changed +18
-12
lines changed Original file line number Diff line number Diff line change @@ -525,15 +525,21 @@ export class Overmind<Config extends Configuration> implements Configuration {
525525 if ( key === '__esModule' ) {
526526 return aggr
527527 }
528+ const originalDescriptor = Object . getOwnPropertyDescriptor ( state , key )
529+
530+ if ( originalDescriptor && 'get' in originalDescriptor ) {
531+ Object . defineProperty ( aggr , key , originalDescriptor as any )
532+
533+ return aggr
534+ }
528535
529536 const value = state [ key ]
537+
530538 if ( isPlainObject ( value ) ) {
531539 aggr [ key ] = this . processState ( value )
532540 } else if ( typeof value === 'function' ) {
533541 aggr [ key ] = new Derived ( value )
534542 } else {
535- var originalDescriptor = Object . getOwnPropertyDescriptor ( state , key )
536-
537543 Object . defineProperty ( aggr , key , originalDescriptor as any )
538544 }
539545
Original file line number Diff line number Diff line change @@ -181,19 +181,19 @@ export class Proxifier {
181181
182182 const method = String ( prop )
183183
184- // On POP we can optimally remove cached proxy by removing the specific one
185- // that was removed. If it is a PUSH, we do not have to remove anything, as
186- // existing proxies stays the same
187- if ( method === 'pop' ) {
188- proxifier . tree . master . removeProxy ( nestedPath )
189- } else if ( method !== 'push' ) {
190- proxifier . tree . master . removeProxy ( path )
191- }
192-
193184 if (
194- arrayMutations . has ( String ( prop ) ) &&
185+ arrayMutations . has ( method ) &&
195186 proxifier . shouldTrackMutations ( nestedPath )
196187 ) {
188+ // On POP we can optimally remove cached proxy by removing the specific one
189+ // that was removed. If it is a PUSH, we do not have to remove anything, as
190+ // existing proxies stays the same
191+ if ( method === 'pop' ) {
192+ proxifier . tree . master . removeProxy ( nestedPath )
193+ } else if ( method !== 'push' ) {
194+ proxifier . tree . master . removeProxy ( path )
195+ }
196+
197197 proxifier . ensureMutationTrackingIsEnabled ( nestedPath )
198198 return ( ...args ) => {
199199 const mutationTree = proxifier . getMutationTree ( )
You can’t perform that action at this time.
0 commit comments