fix(android): share atomic storage creation across access paths - #1338
fix(android): share atomic storage creation across access paths#1338OskarEichler wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: ee05799 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
krizzu
left a comment
There was a problem hiding this comment.
if this PR is only to "prevent redundant native storage creation.", getOrPut already does just that.
|
The specific race was across |
|
yes, that'd make sense for RN if there would be concurrency concerns and need for atomicity here |
Summary
Reuse getStorage's computeIfAbsent path when constructing RNStorage to prevent redundant native storage creation.
Compatibility / observable behavior
No API change; concurrent callers no longer initialize an unused database instance.
Related to #1331. This is a focused part of a source review; it does not claim the entire repository is bug-free.
Test Plan
yarn build:js,yarn test:ts(6 tasks),yarn test:lint(6 tasks),yarn test:formatandgit diff --checkpass on the combined review checkout.testAndroidHostTest,macosArm64TestandiosSimulatorArm64Testpass with Java 21. The first Android run used Java 17 and failed Robolectric's SDK 36/JDK check; rerunning with the project's documented JDK fixed the environment failure without a source workaround.