-
Notifications
You must be signed in to change notification settings - Fork 226
Allow configuring a custom event store in React Native tracker (closes #1413) #1418
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
+196
−59
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b52ffcc
Move @react-native-async-storage/async-storage to peer dependencies
valeriobelli 2425bd7
Allow to specify a custom AsyncStorage implementation
valeriobelli 836b80f
Remove optionality of AsyncStorage in plugins
valeriobelli 2e829e9
Rename AsyncStorage-related mocks in React Native tracker tests
valeriobelli 5c76821
Revert types of EventStoreConfiguration
valeriobelli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that it makes more sense to set
async-storage
as a peer dependency now so that it can more easily be ignored but unfortunately that'd be a breaking change for users who have previously relied on it being included in the tracker package (in thereact-native-get-random-values
case we did move it to peer dependencies in a minor version but that was because it had to be installed as a peer dependency anyway in the app so users probably had it installed like that anyway).Could you please keep it as a dependency? Otherwise this will block us from releasing the change in the v4 tracker. Happy to move it to peer dependencies in v5 but that will take some time for us to get to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can move it. 😊
Before proceeding, I have a little bit of doubt. I agree that moving it to the
peerDependencies
force this Pull Request to introduce a breaking change. However, doesn't it apply the same way forcrypto.getRandomValues
andreact-native-get-random-values
? Currently, in 4.4.0 and below, consumers are not notified to install@react-native-async-storage/async-storage
(e.g., Yarn notifies consumers when a peer dependency is not correctly satisfied). They likely get a runtime error when the Snowplow tracker tries to access the global AsyncStorage, given there might not be available platform bindings, the same that happens when the tracker tries to accesscrypto.getRandomValues
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay on this.
Regarding the
react-native-get-random-values
case, I was under the impression that even though it was not a peer dependency, the tracker would not work without it being explicitly included in the app dependencies – that's what issue #1409 reported. I am not aware that theasync-storage
also needs to explicitly included in the app. At least based on my tests I didn't need to do so, but could be wrong?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @matus-tomlein, sorry for being late here. 🙇🏽
As far as I can see, React Native AsyncStorage must be linked, given it exposes React Native bindings.
In other words, the app will crash if a consumer omits
@react-native-async-storage/async-storage
in the package.json. This is a small repro.The following is a preview of what would happen when omitted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, thank you for that reproduction!