Skip to content

fix: prevent locking before setting new user data #751

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

Merged
merged 1 commit into from
Jan 31, 2023

Conversation

oscb
Copy link
Contributor

@oscb oscb commented Jan 27, 2023

This fixes an issue where identify followed by a track call without awaiting would still end up with userId not being set correctly.

The order is important inside InjectUserInfo, previously it was locking when accessing the current user data before getting to set, which caused track to finish before identify.
It isn't required to do a get before set as the setter will get access to its most current state when run.

Added tests to prevent regressions.

@oscb oscb merged commit d8439e3 into master Jan 31, 2023
@oscb oscb deleted the oscb/concurrencyFixes branch January 31, 2023 02:08
oscb pushed a commit that referenced this pull request Feb 2, 2023
## [@segment/analytics-react-native-v2.11.0](https://github.com/segmentio/analytics-react-native/compare/@segment/analytics-react-native-v2.10.1...@segment/analytics-react-native-v2.11.0) (2023-02-02)

### Features

* add end method to flush policies for cleanup ([#753](#753)) ([96b0893](96b0893))

### Bug Fixes

* prevent locking before setting new user data ([#751](#751)) ([d8439e3](d8439e3))
* refactor allSettled to remove dependencies ([#746](#746)) ([479e468](479e468))
* remove non-required parameters from native calls ([#750](#750)) ([6ebd65e](6ebd65e))
@oscb
Copy link
Contributor Author

oscb commented Feb 2, 2023

🎉 This PR is included in version @segment/analytics-react-native-v2.11.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@oscb oscb added the released label Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants