-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix: Decycling of objects #1839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Generated by 🚫 dangerJS |
packages/utils/src/object.ts
Outdated
// tslint:disable-next-line:no-parameter-reassignment | ||
memo = new Memo(); | ||
} | ||
if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (isArray(obj) || isPlainObject(obj))
would work better here imo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test fail with:
RangeError: Maximum call stack size exceeded
at new WeakSet (<anonymous>)
at new Memo (/Users/haza/Projects/sentry-javascript/packages/utils/src/memo.ts:12:92)
at decycle (/Users/haza/Projects/sentry-javascript/packages/utils/src/object.ts:259:110)
at Object.<anonymous> (/Users/haza/Projects/sentry-javascript/packages/utils/src/object.ts:283:228)
at JSON.stringify (<anonymous>)
at Object.safeNormalize (/Users/haza/Projects/sentry-javascript/packages/utils/src/object.ts:292:32)
at Object.<anonymous> (/Users/haza/Projects/sentry-javascript/packages/utils/test/object.test.ts:400:31)
at Object.asyncFn (/Users/haza/Projects/sentry-javascript/node_modules/jest-jasmine2/build/jasmine_async.js:82:37)
at resolve (/Users/haza/Projects/sentry-javascript/node_modules/jest-jasmine2/build/queue_runner.js:52:12)
at new Promise (<anonymous>)
if I do this
@HazAT issues linked within the PR description ain't auto-closed (it works only when format matches |
@Sija thx, good to know |
Use WeakSet if available, simple decycling for object, thanks @mitsuhiko
Fixes:
#1798
#1801
#1702