11import { SentryWrappedFunction } from '@sentry/types' ;
2- import { isArray , isNaN , isPlainObject , isPrimitive , isUndefined } from './is' ;
2+ import { isArray , isNaN , isPlainObject , isPrimitive , isSyntheticEvent , isUndefined } from './is' ;
33import { Memo } from './memo' ;
44import { truncate } from './string' ;
55
@@ -291,10 +291,6 @@ function normalizeValue(value: any, key?: any): any {
291291 return '[Document]' ;
292292 }
293293
294- if ( value instanceof Date ) {
295- return `[Date] ${ value } ` ;
296- }
297-
298294 if ( value instanceof Error ) {
299295 return objectifyError ( value ) ;
300296 }
@@ -304,6 +300,11 @@ function normalizeValue(value: any, key?: any): any {
304300 return Object . getPrototypeOf ( value ) ? value . constructor . name : 'Event' ;
305301 }
306302
303+ // React's SyntheticEvent thingy
304+ if ( isSyntheticEvent ( value ) ) {
305+ return '[SyntheticEvent]' ;
306+ }
307+
307308 if ( isNaN ( value ) ) {
308309 return '[NaN]' ;
309310 }
@@ -328,6 +329,12 @@ function normalizeValue(value: any, key?: any): any {
328329export function decycle ( obj : any , memo : Memo = new Memo ( ) ) : any {
329330 // tslint:disable-next-line:no-unsafe-any
330331 const copy = isArray ( obj ) ? obj . slice ( ) : isPlainObject ( obj ) ? assign ( { } , obj ) : obj ;
332+ const normalized = normalizeValue ( obj ) ;
333+
334+ // If an object was normalized to its string form, we should just bail out as theres no point in going down that branch
335+ if ( typeof normalized === 'string' ) {
336+ return normalized ;
337+ }
331338
332339 if ( ! isPrimitive ( obj ) ) {
333340 if ( memo . memoize ( obj ) ) {
0 commit comments