-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Conversation
size-limit report 📦
|
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.
Nice and great tests, btw!
packages/utils/src/object.ts
Outdated
* Works recursively on objects and arrays. | ||
*/ | ||
export function dropUndefinedKeys<T>(val: T): T { |
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.
Small nit: Should we update the JSDoc and mention that the function handles circular references?
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.
Yup, thanks. Added comment describing what the function does with circ refs - whis is also implying that it handles circ refs ^^ -> 4429b64
Gets rid of infinite recursion in
dropUndefinedKeys
when passing objects/arrays with circular references.Reported in #2470 (comment)