-
Notifications
You must be signed in to change notification settings - Fork 473
multiMerge
will *overwrite* key on iOS for '{}'
#1046
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
Comments
This issue has been marked as stale due to inactivity. Please respond or otherwise resolve the issue within 7 days or it will be closed. |
I've worked around this, but this is not stale; I've attached a test case and the relevant code that appears to cause the issue. This issue potentially causes data loss. |
I don't know about the maintainers of this project, but to me, unexpected data loss issues are not very encouraging signs. I'm happy to provide a PR if maintainers show interest. |
@irisjae Thanks for the details explanation, I'll try to find some time later next week to look into that 🙏 |
🎉 This issue has been resolved in version 1.22.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What happened?
According to documentation, the function of
multiMerge
isMultiple merging of existing and new values in a batch. Assumes that values are stringified JSON. Once completed, invokes callback with errors (if any).
One expects that the empty object
{}
is the identity of the operation of merging objects, and that merging the JSON-ified object"{}"
into any value that is already an object will produce no effect.This is the case on Android and not the case on iOS (tested with 1.19.3). The following snippet reproduces this, producing
'{ "x": 1 }'
for key "a" on Android, and producing'{}'
on iOS.The bug is caused by this line
async-storage/packages/default-storage-backend/ios/RNCAsyncStorage.mm
Line 791 in 9d9bb1a
async-storage/packages/default-storage-backend/android/src/main/java/com/reactnativecommunity/asyncstorage/next/StorageSupplier.kt
Line 61 in 9d9bb1a
Version
1.19.3
What platforms are you seeing this issue on?
System Information
Steps to Reproduce
Provided above
The text was updated successfully, but these errors were encountered: