Git Product home page Git Product logo

Comments (7)

rt2zz avatar rt2zz commented on May 17, 2024

good catch. it was renamed to skipRestore. There are multiple options for delaying the rendering, and this is in fact the reason skipRestore was added.

Option 1: getStoredState w/ callback
Option 2: App.js lifecycle hooks
Option 3: Set a piece of state rehydrated: true in response to REHYDRATE_COMPLETE action.

Not sure the best option for your use case. I typically like option 3 but it does require wiring up your reducer appropriately

from redux-persist.

rt2zz avatar rt2zz commented on May 17, 2024

btw just updated the readme with skipRestore

from redux-persist.

af avatar af commented on May 17, 2024

Thanks! Not sure how I missed getStoredState()

from redux-persist.

rt2zz avatar rt2zz commented on May 17, 2024

@af its a new api that honestly I am uncertain about right now. Let me know how it feels for you - it could potentially become the recommended usage.

from redux-persist.

af avatar af commented on May 17, 2024

One potential issue with it for me is that I export my persister (the output of persistStore()) so I can purge the store elsewhere. AFAIK having persistStore() in a callback means I can't export it anymore using ES6 modules. I haven't tried any workarounds for this yet, but one of your other two approaches may work for me anyways.

from redux-persist.

rt2zz avatar rt2zz commented on May 17, 2024

hm yes no super elegant way to export persistor in this scenario. I will think about it. I would say option 3 will always give you the most optionality albeit at a certain effort to implement.

from redux-persist.

af avatar af commented on May 17, 2024

Yeah I've gone with option 3, was very easy and seems to do what I need. Thanks again for your suggestions!

from redux-persist.

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.