Skip to content
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

React-native: Require user-provided async storage #7801

Merged
merged 5 commits into from
Nov 3, 2019
Merged

Conversation

Gongreg
Copy link
Member

@Gongreg Gongreg commented Aug 19, 2019

Issue: #6078

What I did

Removed async storage usage in storybook, added ability to pass custom storage.

react-native-community/async-storage is a native dependency that requires linking. Some apps might not use it, so that would mean that storybook requires native dependency that the app itself doesn't have. That bring additional barrier to users. To avoid it we can allow to pass asyncStorage as a parameter to getStorybookUI({asyncStorage: require('react-native').AsyncStorage or require('@react-native-community/async-storage') or any other storage that has getItem and setItem}). Overall async storage functionality in storybook itself is not a core feature but a good to have thing, so asking for additional option shouldn't be too bad.

@vercel
Copy link

vercel bot commented Aug 19, 2019

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/storybook/monorepo/m31knmawo
🌍 Preview: https://monorepo-git-fix-async-storage.storybook.now.sh

@github-actions
Copy link
Contributor

Fails
🚫 PR is marked with "BREAKING CHANGE" label.

Generated by 🚫 dangerJS against 7c47565

@Gongreg
Copy link
Member Author

Gongreg commented Aug 19, 2019

@shilman, it is kinda a breaking change, we are making some functionality opt in.
We need to add information in documentation about it.

@shilman
Copy link
Member

shilman commented Aug 19, 2019

@Gongreg can you give it a default value that does not make it a breaking change?

@Gongreg
Copy link
Member Author

Gongreg commented Aug 19, 2019

Not really, since that is the main reason why I move async storage out. I don’t know what is going to be used. If user doesn’t pass anything nothing bad will happen. It will simply skip trying to read/write to asyncStorage.

Thats why it is not really a breaking change, but rather moving out feature as opt in.

@shilman
Copy link
Member

shilman commented Aug 19, 2019

why can't you just make it default to the previous behavior, then it will not be breaking at all. and users can still overwrite it to use a different storage provider if they wish. in 6.0 you can make it completely opt in?

@shilman
Copy link
Member

shilman commented Aug 19, 2019

or does simply having the dependency introduce problems?

@Gongreg
Copy link
Member Author

Gongreg commented Aug 19, 2019

Exactly. If we introduce new dependency it brings native dependencies and we cant use old one since it doesnt exist in RN 59+

@Gongreg
Copy link
Member Author

Gongreg commented Aug 26, 2019

@shilman, so what should we do next?

@benoitdion
Copy link
Member

@Gongreg we could default to require('react-native').AsyncStorage in the next version with a deprecation warning and remove the default in the version storybook version after that.

@Gongreg
Copy link
Member Author

Gongreg commented Aug 29, 2019

I guess we can do that for deprecation. But we also cant start to use react native community one.

@benoitdion
Copy link
Member

Right. After the deprecation, the default implementation will be a noop

@ndelangen ndelangen added this to the 6.0.0 milestone Aug 30, 2019
@stale
Copy link

stale bot commented Sep 20, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Sep 20, 2019
@stale
Copy link

stale bot commented Nov 2, 2019

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

@stale stale bot closed this Nov 2, 2019
@Gongreg Gongreg reopened this Nov 2, 2019
@stale stale bot removed the inactive label Nov 2, 2019
@Gongreg
Copy link
Member Author

Gongreg commented Nov 2, 2019

@shilman, @ndelangen I still feel like this is a way to solve the issue.

This will not be a "real" breaking change. If users want to continue to use asyncStorage then they will have to update, but they won't have to do anything if they don't need it.

@Gongreg
Copy link
Member Author

Gongreg commented Nov 2, 2019

There is already React Native version 0.61, so I think we are blocking users from using storybook by not implementing this fix.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 2, 2019

Fails
🚫 PR is marked with "BREAKING CHANGE" label.

Generated by 🚫 dangerJS against f9dd781

@Gongreg Gongreg modified the milestones: 6.0.0, 5.3.0 Nov 3, 2019
@shilman
Copy link
Member

shilman commented Nov 3, 2019

@Gongreg please document the migration and then we break semver for this

  1. In MIGRATION.md
  2. As a warning if the user does not opt in, it should tell them how to opt in

@Gongreg
Copy link
Member Author

Gongreg commented Nov 3, 2019

@shilman, regarding the warning, you mean that in version v5 we display a warning to use new key, or manually set it to false? And in v6 we just remove the warning?

@Gongreg
Copy link
Member Author

Gongreg commented Nov 3, 2019

@shilman, added a warning

@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2019

Fails
🚫 PR is marked with "BREAKING CHANGE" label.

Generated by 🚫 dangerJS against 050b5aa

@vercel vercel bot temporarily deployed to staging November 3, 2019 23:04 Inactive
@shilman shilman changed the title Allow to pass custom storage. React-native: Require user-provided async storage Nov 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants