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>):
108
108
if ( typeof transformedState !== 'undefined' && transformedState !== null ) {
109
109
const client = getCurrentHub ( ) . getClient ( ) ;
110
110
const options = client && client . getOptions ( ) ;
111
- const normalizationDepth = options && options . normalizeDepth ;
111
+ const normalizationDepth = ( options && options . normalizeDepth ) || 3 ; // default state normalization depth to 3
112
112
113
113
// 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 } } ;
114
115
addNonEnumerableProperty (
115
- transformedState ,
116
+ newStateContext ,
116
117
'__sentry_override_normalization_depth__' ,
117
- normalizationDepth || 3 ,
118
+ 3 + // 3 layers for `state.value.transformedState`
119
+ normalizationDepth , // rest for the actual state
118
120
) ;
119
121
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
-
124
122
scope . setContext ( 'state' , newStateContext ) ;
125
123
} else {
126
124
scope . setContext ( 'state' , null ) ;
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ function visit(
105
105
// have already been normalized.
106
106
let overriddenDepth = depth ;
107
107
108
- if ( ( value as ObjOrArray < unknown > ) [ '__sentry_override_normalization_depth__' ] ) {
108
+ if ( typeof ( value as ObjOrArray < unknown > ) [ '__sentry_override_normalization_depth__' ] === 'number' ) {
109
109
overriddenDepth = ( value as ObjOrArray < unknown > ) [ '__sentry_override_normalization_depth__' ] as number ;
110
110
}
111
111
You can’t perform that action at this time.
0 commit comments