Skip to content
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

fix(utils): Fix infinite recursion in dropUndefinedKeys #5163

Merged
merged 3 commits into from
May 25, 2022

Conversation

lforst
Copy link
Member

@lforst lforst commented May 25, 2022

Gets rid of infinite recursion in dropUndefinedKeys when passing objects/arrays with circular references.

Reported in #2470 (comment)

@lforst lforst requested review from Lms24 and lobsterkatie May 25, 2022 09:26
@github-actions
Copy link
Contributor

github-actions bot commented May 25, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.36 KB (-3.89% 🔽)
@sentry/browser - ES5 CDN Bundle (minified) 60.03 KB (-7.09% 🔽)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.21 KB (-3.43% 🔽)
@sentry/browser - ES6 CDN Bundle (minified) 53.66 KB (-7.43% 🔽)
@sentry/browser - Webpack (gzipped + minified) 19.93 KB (-14.24% 🔽)
@sentry/browser - Webpack (minified) 63.12 KB (-22.75% 🔽)
@sentry/react - Webpack (gzipped + minified) 19.95 KB (-14.29% 🔽)
@sentry/nextjs Client - Webpack (gzipped + minified) 43.77 KB (-8.93% 🔽)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 25.38 KB (-2.68% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 23.93 KB (-2.27% 🔽)

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and great tests, btw!

Comment on lines 208 to 210
* Works recursively on objects and arrays.
*/
export function dropUndefinedKeys<T>(val: T): T {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit: Should we update the JSDoc and mention that the function handles circular references?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, thanks. Added comment describing what the function does with circ refs - whis is also implying that it handles circ refs ^^ -> 4429b64

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.

3 participants