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): Make new non-enumerable properties mutable #4528

Merged
merged 2 commits into from
Feb 10, 2022

Conversation

lobsterkatie
Copy link
Member

There are a few places in the SDK where we add properties to an object in order to store data for internal use. In cases where there's a chance that object might be serialized, we need to make sure the new properties are non-enumerable, which we do with the (appropriately-named) function addNonEnumerableProperty.

Currently, the non-enumerable properties we add are also immutable, even though nothing requires them to be, simply because that's the default when using Object.defineProperty(). This blocks use-cases in which a user might choose to modify an internal property's value in order to change how the SDK behaves. (See the attached issue for an example of such a use-case.)

This PR explicitly makes these properties mutable. It also changes the docstring to reflect the fact that the function can be used for more than just setting properties on function objects.

Fixes #4525.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2022

size-limit report

Path Base Size (5df78df) Current Size Change
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.77 KB 19.78 KB +0.07% 🔺
@sentry/browser - ES5 CDN Bundle (minified) 63.17 KB 63.2 KB +0.05% 🔺
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.51 KB 18.53 KB +0.08% 🔺
@sentry/browser - ES6 CDN Bundle (minified) 56.8 KB 56.83 KB +0.06% 🔺
@sentry/browser - Webpack (gzipped + minified) 22.21 KB 22.22 KB +0.05% 🔺
@sentry/browser - Webpack (minified) 76.02 KB 76.05 KB +0.04% 🔺
@sentry/react - Webpack (gzipped + minified) 22.24 KB 22.25 KB +0.05% 🔺
@sentry/nextjs Client - Webpack (gzipped + minified) 46.31 KB 46.33 KB +0.03% 🔺
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 28.32 KB 28.34 KB +0.05% 🔺

@lobsterkatie lobsterkatie merged commit ebba343 into master Feb 10, 2022
@lobsterkatie lobsterkatie deleted the kmclb-make-non-enumerable-properties-mutable branch February 10, 2022 01:08
@AbhiPrasad AbhiPrasad added this to the Pre 7.0.0 Work milestone Feb 23, 2022
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.

Allow exception recapturing with option, please!
2 participants