jasonmerino / react-native-simple-store

A minimalistic wrapper around React Native's AsyncStorage.

Home Page:https://www.npmjs.com/package/react-native-simple-store

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why doesn't update use AsyncStorage.mergeItem?

bogobogo opened this issue · comments

Hey,

Thanks for the package, it is great.

A question: why does update gets an item to the js side, deep merges it with the provided value and saves the result, rather then use AsyncStorage.mergeItem, which handles the deepMerge on the native side, thus saving an unnecessary cross over the bridge?

If there is no reason, I can create a pull request to use mergeItem instead.

Thanks again!

I can't remember exactly, but I think the reason that I didn't go with the mergeItem function is because of the note here.

NOTE: This is not supported by all native implementations.

I couldn't find any further documentation on how to check if mergeItem is supported on any given platform so I just went with the lodash.merge option.

I'm going to close this issue for now. If you want to continue chatting about this change feel free to leave another comment here.