Giter Club home page Giter Club logo

Comments (5)

zan-rosenthal avatar zan-rosenthal commented on June 8, 2024

Hey @losh11, could you create a repro for this issue? I've been having trouble reproducing it. Also, not sure if this is related, but redux-persist 6.0.0 is a fairly recent release. Did you notice it before upgrading that package?

from redux-persist-sensitive-storage.

richeterre avatar richeterre commented on June 8, 2024

Our team just ran into this exact same issue, so I used Reactotron to diagnose what is going on. Turns out that a few seconds after sending the app to the background, the following error is thrown:

image

Then when bringing the app to the foreground, Reactotron shows an empty payload for the persist/REHYDRATE action, indicating that the state wasn't persisted correctly.

I can also confirm that switching to @react-native-community/async-storage fixes the issue.

from redux-persist-sensitive-storage.

randycoulman avatar randycoulman commented on June 8, 2024

@richeterre Thanks for the excellent detective work! From this error message, it looks as though react-native-sensitive-info is not being allowed to write to the secure storage after the application has been sent to the background.

It's been a couple of years since I spent any significant time in this codebase, but if I'm remembering correctly, redux-persist will attempt to persist the Redux store whenever the store updates.

I'm wondering if your application dispatches an action as it goes into the background, which triggers redux-persist to attempt to persist the store, but that is now failing because the OS isn't allowing the secure storage to be written by a background application? This is all just speculation on my part.

From what I can see, I don't think there's anything we can do in this library to address the issue, as we're not the ones doing the actual write to the secure storage area. That part is handled by react-native-sensitive-info, so perhaps you could report this issue to that project to see if they've got any insight that might help.

If you disagree and think there is something we can do here, please re-open and let us know what that might be.

from redux-persist-sensitive-storage.

randycoulman avatar randycoulman commented on June 8, 2024

@losh11 @richeterre One more thing: it would probably be worth mentioning whether this issue happens on iOS, Android, or both (and which versions of the OS) when you open the issue on react-native-sensitive-info. Perhaps this is new behavior with iOS 13?

from redux-persist-sensitive-storage.

richeterre avatar richeterre commented on June 8, 2024

Thanks @randycoulman for your detailed response! I had already suspected the same – that the issue is with react-native-sensitive-info. I've worked around the bug for now by switching to the react-native-keychain library and a lightweight wrapper around it.

I'm wondering if your application dispatches an action as it goes into the background, which triggers redux-persist to attempt to persist the store, but that is now failing because the OS isn't allowing the secure storage to be written by a background application?

Yes, our app does regular polling on its home screen, which continues for some time in the background until the OS shuts it down. Part of this state is included in the persisted whitelist. So that's likely the reason why the persisted store gets "corrupted" as the write eventually fails.

For me this happens on iOS (not supporting Android right now, so can't say) and it did start around the time we upgraded to iOS 13. On the other hand, we did some big React Native upgrades around the same time, so I can't say for sure what caused it.

from redux-persist-sensitive-storage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.