Skip to content

ref: Doesnt allow for popping last layer and unify getter methods#2955

Merged
kamilogorek merged 1 commit intomasterfrom
hub-refactor
Oct 7, 2020
Merged

ref: Doesnt allow for popping last layer and unify getter methods#2955
kamilogorek merged 1 commit intomasterfrom
hub-refactor

Conversation

@kamilogorek
Copy link
Contributor

Preventing the popping of the last layer makes it in line with sentry-python behavior. It didn't make much sense to allow that in the first place. Because of that change, during construction, it'll update the initially empty layer instead of pushing a new one.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2020

size-limit report

Path Size
@sentry/browser - CDN Bundle (gzipped) 18.02 KB (+0.03% 🔺)
@sentry/browser - Webpack 18.84 KB (-0.01% 🔽)
@sentry/react - Webpack 18.84 KB (-0.01% 🔽)
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 23.9 KB (-0.01% 🔽)

@kamilogorek kamilogorek requested review from HazAT and rhcarvalho and removed request for rhcarvalho October 7, 2020 10:54
@kamilogorek kamilogorek merged commit dd8e392 into master Oct 7, 2020
@kamilogorek kamilogorek deleted the hub-refactor branch October 7, 2020 11:37
if (finalBreadcrumb === null) {
return;
}
if (finalBreadcrumb === null) return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a big fan of if without {}, a bit harder to read when scanning quickly through code, easier to introduce bugs. (isn't there a linter rule for this?!)

On top of that this change is introducing inconsistency in style. For example, later in this file:
image

public popScope(): boolean {
return this.getStack().pop() !== undefined;
if (this.getStack().length <= 1) return false;
return !!this.getStack().pop();
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be accessing this._stack directly, same in pushScope.

Why is there even a public getStack()?! Is there a use case to deal with stack layers from code external to this class?!

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