Storage is not retained after force quit and re-open of app
See original GitHub issueCurrent behavior
Items set via AsyncStorage seem to be cleared on apps that are forced quit and re-opened.
Expected behavior
Storage should persist even if an app is forced quit and also with app updates (but I have not tested this scenario yet).
Repro steps
Follow basic example code https://react-native-async-storage.github.io/async-storage/docs/api#useasyncstorage to get / set an item.
- on App load,
getItem
- show a modal on first time loading the app and upon clicking the “Accept” button triggers the
setItem
- switch out of the app
- come back and app state is remembered
- force quit
- re-open app
- modal dialog is shown again but shouldn’t be if state is remembered
I’ve also added Sentry exception calls in the catch
but not receiving any errors so I don’t think AsyncStorage is failing.
Environment
- Platforms tested:
- Android
- iOS
- macOS
- Windows
- AsyncStorage version: ^1.13.2
- Environment:
System: OS: macOS 10.15.7 CPU: (8) x64 Intel® Core™ i7-7700HQ CPU @ 2.80GHz Memory: 751.25 MB / 16.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 15.5.1 - /var/folders/36/vnmypcbj02xf8_c2fp8gnl700000gn/T/yarn–1610253002684-0.4976098686317718/node Yarn: 1.22.10 - /var/folders/36/vnmypcbj02xf8_c2fp8gnl700000gn/T/yarn–1610253002684-0.4976098686317718/yarn npm: 7.3.0 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.10.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 14.3, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2 Android SDK: Not Found IDEs: Android Studio: 4.1 AI-201.8743.12.41.6953283 Xcode: 12.3/12C33 - /usr/bin/xcodebuild Languages: Java: 12.0.1 - /usr/bin/javac Python: 2.7.16 - /usr/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: 0.63.4 => 0.63.4 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Also using Expo SDK 40 in a managed workflow.
- Logs/Errors that may be relevant:
Might be related to #517
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:18 (5 by maintainers)
Top GitHub Comments
To my embarrassment, it was an implementation detail that caused this. Thanks for the clarification @Krizzu and @tido64
I have it working now and published the app to production!
To be clear, this is not AsyncStorage not supporting Expo’s managed workflow. It’s the other way around.