We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Same situation with ObservablePersistMMKV
ObservablePersistMMKV
export const persistentStorage = Platform.OS === 'web' ? ObservablePersistLocalStorage : ObservablePersistMMKV
export const auth$ = observable<Index>({ isAuthorized: (): boolean => !!auth$.credentials.get()?.accessToken, loading: false, credentials: undefined, logOut: () => { auth$.credentials.delete() router.replace("/"); }, authRequest: async (data: UserData): Promise<boolean> => { .... if (response.status === 200) { auth$.credentials.set(response.data.data); } ...
syncObservable(auth$, { persist: { plugin: persistentStorage, } })
if (!auth$.credentials.get()) { // true - credentials not found return <Redirect href="/sign-in"/> }
After refreshing App credentials did not restoring
The text was updated successfully, but these errors were encountered:
I think you're missing setting a name on the persist options: https://www.legendapp.com/open-source/state/v3/sync/persist-sync/#mmkv-rn. Multiple observables can use the same persistence plugin but need to save to a difference key inside of the persistence.
name
So this should fix it:
syncObservable(auth$, { persist: { plugin: persistentStorage, name: 'auth' } })
Or did you just miss including that in the example and it's something else?
Sorry, something went wrong.
No branches or pull requests
Same situation with
ObservablePersistMMKV
After refreshing App credentials did not restoring
The text was updated successfully, but these errors were encountered: