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

Always allow userId override with explicit argument #101

Conversation

Munter
Copy link
Contributor

@Munter Munter commented Mar 23, 2024

This changes behavior to always prefer a passed-in userId over any persisted user id.

We've seen situations where race conditions can lead to en error being thrown by our SDK when following segments recommended approach to logging out:

analytics.track('Signed Out');
analytics.reset();

The bucket SDK can be reset before the event get tracked, which currently throws because only the persisted userId is taken into account, despite segment actually providing a userId explicitly in the bucket.event()-call

There is a possible discussion to be had on the behavior where both a persisted userId exists and an explicit userId is passed along. In this PR I treat the userId argument as authoritative, but we might want the behavior to be preferring the persisted userId if one exists

@roncohen
Copy link
Contributor

roncohen commented Apr 4, 2024

@Munter should we get this in?

@Munter
Copy link
Contributor Author

Munter commented Apr 4, 2024

@roncohen I'll merge now. Just wanted to be sure there was no controversy with choosing the userId arg to be used as an override for a possibly available persisted userId

@Munter Munter merged commit 49ea5a8 into fix-broken-local-date-mocks Apr 4, 2024
3 checks passed
@Munter
Copy link
Contributor Author

Munter commented Apr 4, 2024

What semver bit should we flip on this? I'd say it's a bugfix, so I'd just do a patch release on it

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

3 participants