Closed
Description
What happened?
According to documentation, the function of multiMerge
is Multiple 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.
let { default: { multiMerge, getAllKeys, multiGet } } = require ('@react-native-async-storage/async-storage')
Promise .resolve ()
.then (_ => multiMerge ([ [ 'a', '{ "x": 1 }' ] ] ))
.then (_ => multiMerge ([ [ 'a', '{}' ] ] ))
.then (_ => getAllKeys ())
.then (keys => multiGet (keys))
.then (entries => Object .fromEntries (entries))
.then (result => console .log (result))
The bug is caused by this line
Version
1.19.3
What platforms are you seeing this issue on?
- Android
- iOS
- macOS
- Windows
- web
System Information
.
Steps to Reproduce
Provided above