Skip to content

Conversation

@Lms24
Copy link
Member

@Lms24 Lms24 commented Jan 11, 2024

When creating a session, we previously only read the user from the isolation scope. This was problematic because the user could be set in initialScope which will be applied to the current scope on SDK init. This would happen before the session is started when using auto session tracking.

This PR now takes the user from the current scope if it's set and falls back to the isolation scope should the user be set there. Added an integration test to cover this regression.

fixes #10146

cc @timfish

const currentScope = getCurrentScope();

const session = isolationScope.getSession();
const session = currentScope.getSession() || isolationScope.getSession();
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 think this was also incorrect before

@Lms24 Lms24 force-pushed the lms/fix-core-session-initialscope branch from 774bc3b to 392a5cf Compare January 11, 2024 17:12
@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay, Feedback) - Webpack (gzipped) 76.98 KB (+0.02% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 68.35 KB (+0.01% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack with treeshaking flags (gzipped) 62 KB (+0.01% 🔺)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 32.38 KB (+0.02% 🔺)
@sentry/browser (incl. Feedback) - Webpack (gzipped) 30.98 KB (+0.02% 🔺)
@sentry/browser - Webpack (gzipped) 22.31 KB (+0.04% 🔺)
@sentry/browser (incl. Tracing, Replay, Feedback) - ES6 CDN Bundle (gzipped) 74.61 KB (+0.01% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 66.26 KB (+0.01% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 32.09 KB (+0.02% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped) 23.9 KB (+0.03% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 208.75 KB (+0.02% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 96.8 KB (+0.03% 🔺)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 71.41 KB (+0.04% 🔺)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 35.06 KB (+0.02% 🔺)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 68.72 KB (+0.01% 🔺)
@sentry/react - Webpack (gzipped) 22.36 KB (+0.04% 🔺)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 85.39 KB (+0.01% 🔺)
@sentry/nextjs Client - Webpack (gzipped) 49.5 KB (+0.02% 🔺)
@sentry-internal/feedback - Webpack (gzipped) 17 KB (0%)

Copy link
Collaborator

@timfish timfish left a comment

Choose a reason for hiding this comment

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

Looks good!

@Lms24 Lms24 merged commit dd72e4d into develop Jan 15, 2024
@Lms24 Lms24 deleted the lms/fix-core-session-initialscope branch January 15, 2024 10:51
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.

New session API endSession doesn't include did from initialScope

4 participants