Skip to content

multiGet does not report errors #105

Closed
@moughxyz

Description

@moughxyz

In https://github.com/react-native-community/react-native-async-storage/blob/608e2d80cd4a8aa3dbb2f7c08fb317ce4a180344/lib/AsyncStorage.js#L226 errors is ignored, and does not propagate up to caller.

I was able to determine this when I noticed some of my items were coming back undefined. If I used AsyncStorage.getItem, then I correctly saw why the item was coming back undefined: Cursor Window: Window is full (the item I was trying to retrieve was greater than 1MB, which seems to be the limit.)

But when using multiGet, the operation would fail silently.

One solution would be to reject if errors:

if(errors) {
  request.reject && request.reject(errors);
} else {
  request.resolve && request.resolve(requestResult);
}

The current implementation resolves indiscriminately:

https://github.com/react-native-community/react-native-async-storage/blob/608e2d80cd4a8aa3dbb2f7c08fb317ce4a180344/lib/AsyncStorage.js#L244

@react-native-community/async-storage 1.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions