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(feedback): Check for empty user #11993

Merged
merged 1 commit into from
May 13, 2024
Merged

fix(feedback): Check for empty user #11993

merged 1 commit into from
May 13, 2024

Conversation

c298lee
Copy link
Member

@c298lee c298lee commented May 13, 2024

When getting the user from the scope, the user can also be an empty object, which doesn't work with null coalescing. This checks to see if the user exists and that it's not empty in all scopes

Fixes getsentry/sentry#70347

@c298lee c298lee requested a review from a team as a code owner May 13, 2024 03:01
@c298lee c298lee requested review from mydea, ryan953 and billyvg May 13, 2024 03:01
if (isolationUser && Object.keys(isolationUser).length) {
return isolationUser;
}
return globalUser;
Copy link
Member

Choose a reason for hiding this comment

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

Can this also return the empty object?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes it can. We want to check all scopes to see if any have been set, and if not, it'll return an empty object. We were using null coalescing before, which didn't work for empty objects, and would return the empty object without checking the other scopes.

Copy link
Contributor

size-limit report 📦

Path Size
@sentry/browser 21.65 KB (0%)
@sentry/browser (incl. Tracing) 32.69 KB (0%)
@sentry/browser (incl. Tracing, Replay) 68.03 KB (0%)
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 61.43 KB (0%)
@sentry/browser (incl. Tracing, Replay with Canvas) 72.07 KB (0%)
@sentry/browser (incl. Tracing, Replay, Feedback) 84.08 KB (+0.04% 🔺)
@sentry/browser (incl. Feedback) 37.58 KB (+0.09% 🔺)
@sentry/browser (incl. sendFeedback) 26.21 KB (0%)
@sentry/browser (incl. FeedbackAsync) 30.58 KB (0%)
@sentry/react 24.33 KB (0%)
@sentry/react (incl. Tracing) 35.66 KB (0%)
@sentry/vue 25.48 KB (0%)
@sentry/vue (incl. Tracing) 34.49 KB (0%)
@sentry/svelte 21.78 KB (0%)
CDN Bundle 24.13 KB (0%)
CDN Bundle (incl. Tracing) 34.06 KB (0%)
CDN Bundle (incl. Tracing, Replay) 67.73 KB (0%)
CDN Bundle (incl. Tracing, Replay, Feedback) 72.71 KB (0%)
CDN Bundle - uncompressed 70.99 KB (0%)
CDN Bundle (incl. Tracing) - uncompressed 101.03 KB (0%)
CDN Bundle (incl. Tracing, Replay) - uncompressed 210.64 KB (0%)
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 222.93 KB (0%)
@sentry/nextjs (client) 34.88 KB (0%)
@sentry/sveltekit (client) 33.26 KB (0%)
@sentry/node 147.43 KB (0%)

@c298lee c298lee merged commit 1098627 into develop May 13, 2024
93 checks passed
@c298lee c298lee deleted the cl/uf-get-user branch May 13, 2024 05:27
andreiborza pushed a commit that referenced this pull request May 16, 2024
When getting the user from the scope, the user can also be an empty
object, which doesn't work with null coalescing. This checks to see if
the user exists and that it's not empty in all scopes

Fixes getsentry/sentry#70347
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.

[User Feedback] Feedback widget is no longer collecting name or email
2 participants