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

BREAKING CHANGE: remove built-in support for react native async storage #76

Merged
merged 2 commits into from
Apr 11, 2022

Conversation

Dzixxx
Copy link
Contributor

@Dzixxx Dzixxx commented Apr 4, 2022

[Breaking Change] v2

Removing built-in support for react-native (will become optional as custom storageProvider provided by developer itself)

  • if will remove a lot of installed dependencies (for react-native it's huge...)
  • it will reduce amount of packages that needs to be maintained (dependabot, renovate...)
  • it's a suggestion to create own client for react-native if more custom things are needed
  • instead of react-native-async-storage which fallbacks to window.localStorage I just used window.localStorage

Kind regards
Dziczek!

@Dzixxx Dzixxx force-pushed the remove-react-native branch 4 times, most recently from 111b5f7 to f1ab6ba Compare April 4, 2022 08:48
@Dzixxx Dzixxx changed the title chore: remove built-in support for react native async storage BREAKING CHANGE: remove built-in support for react native async storage Apr 4, 2022
} catch (ex) {
console.error(ex);
}
}

public async get(name: string) {
public get(name: string) {
Copy link
Member

Choose a reason for hiding this comment

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

Even though we do not need async marker on this method i think I would prefer to have it, to make sure we remember to await the get method also, sense this will be the default implementation. I can easily see myself (or someone else) forgetting the "await" in the calling code, if this method is not marked as async in the default implementation. This will lead to bugs, only visible when using a custom store.

Copy link
Contributor Author

@Dzixxx Dzixxx Apr 7, 2022

Choose a reason for hiding this comment

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

Evening! No problem to get rid of async to but U've defined interface which is Promise based :)

// src/storage-provider.ts
export default interface IStorageProvider {
    save: (name: string, data: any) => Promise<void>;
    get: (name: string) => Promise<any>;
}

Copy link
Member

Choose a reason for hiding this comment

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

good point :D

@ivarconr
Copy link
Member

ivarconr commented Apr 6, 2022

This looks really good. It will also make sense for us to push an update to the react SDK, after we release this one @FredrikOseberg !

@Dzixxx Dzixxx force-pushed the remove-react-native branch 2 times, most recently from 9166b98 to 382a326 Compare April 7, 2022 19:49
@Dzixxx
Copy link
Contributor Author

Dzixxx commented Apr 7, 2022

(rebasing ☝️)

@Dzixxx
Copy link
Contributor Author

Dzixxx commented Apr 11, 2022

@ivarconr ping 😅

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.

2 participants