File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -108,19 +108,17 @@ function createReduxEnhancer(enhancerOptions?: Partial<SentryEnhancerOptions>):
108108 if ( typeof transformedState !== 'undefined' && transformedState !== null ) {
109109 const client = getCurrentHub ( ) . getClient ( ) ;
110110 const options = client && client . getOptions ( ) ;
111- const normalizationDepth = options && options . normalizeDepth ;
111+ const normalizationDepth = ( options && options . normalizeDepth ) || 3 ; // default state normalization depth to 3
112112
113113 // Set the normalization depth of the redux state to the configured `normalizeDepth` option or a sane number as a fallback
114+ const newStateContext = { state : { type : 'redux' , value : transformedState } } ;
114115 addNonEnumerableProperty (
115- transformedState ,
116+ newStateContext ,
116117 '__sentry_override_normalization_depth__' ,
117- normalizationDepth || 3 ,
118+ 3 + // 3 layers for `state.value.transformedState`
119+ normalizationDepth , // rest for the actual state
118120 ) ;
119121
120- // Make sure the state is always reached during normalization
121- const newStateContext = { state : { type : 'redux' , value : transformedState } } ;
122- addNonEnumerableProperty ( newStateContext , '__sentry_override_normalization_depth__' , 3 ) ;
123-
124122 scope . setContext ( 'state' , newStateContext ) ;
125123 } else {
126124 scope . setContext ( 'state' , null ) ;
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ function visit(
105105 // have already been normalized.
106106 let overriddenDepth = depth ;
107107
108- if ( ( value as ObjOrArray < unknown > ) [ '__sentry_override_normalization_depth__' ] ) {
108+ if ( typeof ( value as ObjOrArray < unknown > ) [ '__sentry_override_normalization_depth__' ] === 'number' ) {
109109 overriddenDepth = ( value as ObjOrArray < unknown > ) [ '__sentry_override_normalization_depth__' ] as number ;
110110 }
111111
You can’t perform that action at this time.
0 commit comments