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

ref(utils): Add logic to enable skipping of normalization #5052

Merged
merged 3 commits into from May 9, 2022

Conversation

lforst
Copy link
Member

@lforst lforst commented May 9, 2022

Implements logic that allows us to skip normalization of objects by marking them with a __sentry_skip_normalization__ property.

We will use this in an upcoming PR to fix behaviour in the ExtraErrorData integration: #5053

Ref: https://getsentry.atlassian.net/browse/WEB-600

@lforst lforst added this to the 7.0.0 milestone May 9, 2022
@lforst lforst changed the title ref(utils): Add property flag to skip normalization ref(utils): Add logic to enable skipping of normalization May 9, 2022
@github-actions
Copy link
Contributor

github-actions bot commented May 9, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 18.76 KB (-6.87% 🔽)
@sentry/browser - ES5 CDN Bundle (minified) 58.58 KB (-9.35% 🔽)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 17.55 KB (-6.97% 🔽)
@sentry/browser - ES6 CDN Bundle (minified) 52.76 KB (-9% 🔽)
@sentry/browser - Webpack (gzipped + minified) 19.21 KB (-17.35% 🔽)
@sentry/browser - Webpack (minified) 62.12 KB (-23.99% 🔽)
@sentry/react - Webpack (gzipped + minified) 19.23 KB (-17.39% 🔽)
@sentry/nextjs Client - Webpack (gzipped + minified) 42.75 KB (-11.04% 🔽)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 24.42 KB (-6.34% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 22.99 KB (-6.08% 🔽)

packages/utils/test/normalize.test.ts Outdated Show resolved Hide resolved
// We're also done if we've reached the max depth
if (depth === 0) {
// At this point we know `serialized` is a string of the form `"[object XXXX]"`. Clean it up so it's just `"[XXXX]"`.
return stringified.replace('object ', '');
Copy link
Member

Choose a reason for hiding this comment

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

Why did we move this below the memoize?

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought there was a case where we need to move the memoize call to avoid circular references with objects for which we skip normalization. Your comment made me think about it again and

a) I think there is actually no such case
b) if there were such a case, moving it is pointless because skipping normalization is already "dangerous" in that regard.

Anyways, moved it back, thanks ^^ -> 77e3096

@lforst lforst force-pushed the lforst-normalization-skip-flag branch from fb17f47 to 77e3096 Compare May 9, 2022 13:38
@lforst lforst requested a review from AbhiPrasad May 9, 2022 13:55
@lforst lforst merged commit 8d36f0b into 7.x May 9, 2022
@lforst lforst deleted the lforst-normalization-skip-flag branch May 9, 2022 15:45
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.

None yet

2 participants