Skip to content

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

Merged
merged 5 commits into from
Jan 16, 2019
Merged

fix: Decycling of objects #1839

merged 5 commits into from
Jan 16, 2019

Conversation

HazAT
Copy link
Member

@HazAT HazAT commented Jan 16, 2019

Use WeakSet if available, simple decycling for object, thanks @mitsuhiko

Fixes:
#1798
#1801
#1702

@HazAT HazAT self-assigned this Jan 16, 2019
@HazAT HazAT requested a review from kamilogorek as a code owner January 16, 2019 10:16
@getsentry-bot
Copy link
Contributor

getsentry-bot commented Jan 16, 2019

Messages
📖 ✅ TSLint passed
📖 @sentry/browser gzip'ed minified size: 22.2852 kB

Generated by 🚫 dangerJS

// tslint:disable-next-line:no-parameter-reassignment
memo = new Memo();
}
if (
Copy link
Contributor

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.

Copy link
Member Author

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 HazAT merged commit 1d8eae1 into master Jan 16, 2019
@HazAT HazAT deleted the fix/decycle branch January 16, 2019 11:09
@Sija
Copy link
Contributor

Sija commented Jan 16, 2019

@HazAT issues linked within the PR description ain't auto-closed (it works only when format matches <keyword> #issue_id), just FYI

@HazAT
Copy link
Member Author

HazAT commented Jan 16, 2019

@Sija thx, good to know
Want to reply manually anyways when release is published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants