-
Notifications
You must be signed in to change notification settings - Fork 475
Migrate Expo storage directory on iOS #563
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
Migrate Expo storage directory on iOS #563
Conversation
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.
Nice one 🎖️ Please address the comment I left, this is crucial. Other than that it looks good to go from my side.
@tido64 mind having a look as well? 🙏
ios/RNCAsyncStorage.m
Outdated
// Then migrate what's in "Documents/.../RCTAsyncLocalStorage_V1" to "Application | ||
// Support/[bundleID]/RCTAsyncLocalStorage_V1" | ||
RCTStorageDirectoryMigrationCheck(RCTCreateStorageDirectoryPath_deprecated(RCTStorageDirectory), | ||
RCTCreateStorageDirectoryPath(RCTStorageDirectory), | ||
NO); |
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.
This migration needs to be outside of the if statement - it's not related to Expo, but normal RN projects. If someone upgrades from pre 1.8.0 version, the migration to Application Support won't kick in
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.
addressed this feedback, did manual testing again and works as expected
Android CI failure is unrelated |
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.
LGTM 🚀
Nice one @brentvatne 👏 |
🎉 This PR is included in version 1.15.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary
This solves an issue users encountered with the following process:
Something that I noticed while implementing this was that it is theoretically possible (although extremely unlikely) that a user would have both an old storage directory and an Expo storage directory ("RNCAsyncLocalStorage_V1" and "RCTAsyncLocalStorage"). To handle this case, I added
RCTGetStoragePathForMigration
.The Android side of this migration is handled in #559
Test Plan
expo init
with managed Typescript template,expo install @react-native-async-storage/async-storage
, then added that code to App.tsx).expo build:ios -t simulator
(it takes about 2 minutes to build, you can access the binary here for the next ~28 days).expo eject
, applied the patch from this PR to my local copy ofRNCAsyncStorage.m
, then built the project and ran it on the same simulator as the previous step.Here's a video quick run through the above test plan, skipping the steps that could be done in advance:
post.mp4
(I added !! after the count to make it especially clear that this is a different build)