Skip to content

Prefer PlatformLocalStorage Over Other Native Modules #255

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

Merged

Conversation

NickGerleman
Copy link
Contributor

We currently try to load builtin native modules before trying to
fallback to platform provided native modules. Reversing this order
allows the platform to provide the AsyncStorage implementtion even if
on a platform that async-storage already supports. This ability can
be useful in hosted scenarios where we may want more control over how
data for an individual React Native instance is stored.

This should be entirely unneeded for AsyncStorageV2 since we have IStorageBackend.

We currently try to load builtin native modules before trying to
fallback to platform provided native modules. Reversing this order
allows the platform to provide the AsyncStorage implementtion even if
on a platform that async-storage already supports. This ability can
be useful in hosted scenarios where we may want more control over how
data for an individual React Native instance is stored.
@krizzu
Copy link
Member

krizzu commented Nov 25, 2019

Hey @NickGerleman

This ability can
be useful in hosted scenarios where we may want more control over how
data for an individual React Native instance is stored.

Our initial thoughts were that PlatformLocalStorage module would be used by platforms that do not have the RNCAsyncStorage implementation. In case where both were present, RNCAsyncStorage is used anyway, leaving you no control over it. So I agree - this change looks good.

cc @tido64

@NickGerleman
Copy link
Contributor Author

Oh wow, I didn't actually realize that draft PRs were public. I originally made this just to run CI for a change we were playing with. I can still publish this if we like the idea of the change though.

Copy link
Member

@tido64 tido64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@NickGerleman NickGerleman marked this pull request as ready for review December 1, 2019 13:25
@NickGerleman
Copy link
Contributor Author

@krizzu @tido64 the review should be published now if you want to merge. It seems like the change could still be useful even if we ended up not needing it personally.

@krizzu krizzu merged commit 6142db6 into react-native-async-storage:LEGACY Dec 3, 2019
@krizzu
Copy link
Member

krizzu commented Dec 3, 2019

@NickGerleman Thanks, going to release new version soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants