Skip to content

fix(replay): Replace _waitForError with recordingMode - #6489

Merged
mydea merged 2 commits into
masterfrom
fn/replay-avoid-use-private
Dec 12, 2022
Merged

fix(replay): Replace _waitForError with recordingMode#6489
mydea merged 2 commits into
masterfrom
fn/replay-avoid-use-private

Conversation

@mydea

@mydeamydea commented Dec 9, 2022

Copy link
Copy Markdown
Member

After checking what could be going wrong in #6466, one possible culprit is that we mangle properties prefixed with _. Meaning that it may break when referencing such properties from outside.

As far as I see, we do this in one place as of now - we access _waitForError. So this PR refactors this.

However, imho for a "public" API (of this class, at least), it is not a great API to have waitForError, as it is a bit abstract what that means.
So I changed this to instead be mode, which can be session or error. I think this describes better what is going on, and makes it a bit more explicit when using this etc.

@mydea
mydea requested review from Lms24 and billyvgDecember 9, 2022 15:41
@mydeamydea self-assigned this Dec 9, 2022
@mydeamydea changed the title fix(replay): Replay _waitForError with modefix(replay): Replace _waitForError with modeDec 9, 2022
@github-actions

github-actionsBot commented Dec 9, 2022

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
@sentry/browser - ES5 CDN Bundle (gzipped + minified)19.68 KB (-0.01% 🔽)
@sentry/browser - ES5 CDN Bundle (minified)60.96 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified)18.47 KB (0%)
@sentry/browser - ES6 CDN Bundle (minified)54.51 KB (0%)
@sentry/browser - Webpack (gzipped + minified)20.27 KB (0%)
@sentry/browser - Webpack (minified)66.25 KB (0%)
@sentry/react - Webpack (gzipped + minified)20.29 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified)47.29 KB (0%)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified)26.67 KB (-0.01% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified)25.12 KB (+0.01% 🔺)
@sentry/replay ES6 CDN Bundle (gzipped + minified)41.83 KB (+0.1% 🔺)
@sentry/replay - Webpack (gzipped + minified)37.89 KB (+0.03% 🔺)

@billyvgbillyvg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe recordMode to be more specific?

Comment threadpackages/replay/src/replay.ts
Comment threadpackages/replay/test/unit/index-handleGlobalEvent.test.ts Outdated
And ensure that `mode` is public, so it isn't mangled.

@Lms24Lms24 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

l: Agree w/ Billy that recordingMode is probably a little more verbose.

Let's get this in so that we get rid of the private field. This isn't everything we have to do to fix minified CDN bundles but definitely a cleaner solution than just ignoring the private field in our terser config. Great catch!

@mydea
mydeaforce-pushed the fn/replay-avoid-use-private branch from 64e5fe3 to 75e0900CompareDecember 12, 2022 08:25
@mydea

Copy link
Copy Markdown
MemberAuthor

👍 I changed it to recordingMode!

@mydeamydea changed the title fix(replay): Replace _waitForError with modefix(replay): Replace _waitForError with recordingModeDec 12, 2022
@mydea
mydea merged commit 497a3c7 into masterDec 12, 2022
@mydea
mydea deleted the fn/replay-avoid-use-private branch December 12, 2022 08:46
@mydeamydea mentioned this pull request Dec 12, 2022
5 tasks
Sign up for freeto 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

@mydea@billyvg@Lms24