@@ -98,17 +98,11 @@ function visit(
98
98
return stringified ;
99
99
}
100
100
101
- // From here on, we can assert that `value` is either an object or an array!
101
+ // From here on, we can assert that `value` is either an object or an array.
102
102
103
- // If we've already visited this branch, bail out, as it's circular reference. If not, note that we're seeing it now.
104
- if ( memoize ( value ) ) {
105
- return '[Circular ~]' ;
106
- }
107
-
108
- // Do not normalize objects that we know have already been normalized. This MUST be below the circ-ref check otherwise
109
- // we might somehow accidentally produce circular references by skipping normalization.
110
- // As a general rule, the "__sentry_skip_normalization__" property should only be used sparingly and only should only
111
- // be set on objects that have already been normalized.
103
+ // Do not normalize objects that we know have already been normalized. As a general rule, the
104
+ // "__sentry_skip_normalization__" property should only be used sparingly and only should only be set on objects that
105
+ // have already been normalized.
112
106
if ( ( value as ObjOrArray < unknown > ) [ '__sentry_skip_normalization__' ] ) {
113
107
return value as ObjOrArray < unknown > ;
114
108
}
@@ -119,6 +113,11 @@ function visit(
119
113
return stringified . replace ( 'object ' , '' ) ;
120
114
}
121
115
116
+ // If we've already visited this branch, bail out, as it's circular reference. If not, note that we're seeing it now.
117
+ if ( memoize ( value ) ) {
118
+ return '[Circular ~]' ;
119
+ }
120
+
122
121
// At this point we know we either have an object or an array, we haven't seen it before, and we're going to recurse
123
122
// because we haven't yet reached the max depth. Create an accumulator to hold the results of visiting each
124
123
// property/entry, and keep track of the number of items we add to it.
0 commit comments