Coder Social home page Coder Social logo

2.0 about redux-persist HOT 3 CLOSED

rt2zz avatar rt2zz commented on May 14, 2024
2.0

from redux-persist.

Comments (3)

84564221 avatar 84564221 commented on May 14, 2024

The persistStore configuration API should be removed, since it is a pure functional programming anti-pattern.

You don't use configuration to construct your store, you use composition. In that way, you aren't limited to solely the mechanisms thought out ahead of time.

from redux-persist.

rt2zz avatar rt2zz commented on May 14, 2024

@askmatey I have thought about this, and this is more in line with e.g. how redux-localstorage works

The reasoning for the configuration based approach is that it is simple. IMO the alternative is actually not inherently more "functional", it just moves configuration from being an object to being implicit in what you choose to require. It still suffers from limitations of preconceived design.

That said I am entirely open to a more functional pattern, and any api suggestions would be appreciated.

from redux-persist.

rt2zz avatar rt2zz commented on May 14, 2024

Just pushed a first cut at 2.0 to master. Key changes:

Only one REHYDRATE action which now contains the entire stored state tree. No REHYDRATE_COMPLETE action is needed since, REHYDRATE implicitly means rehydration is complete.

All api's are updated accordingly so e.g. persistor.rehydrate now looks like this: persistor.rehydrate(serialState).

I will continue to mess with the api over the next few days. In particular I want to spend some time thinking over the way transforms and serialization happen.

As far as functional composition, I am open to suggestions for how to improve this. I suspect we will always need a configuration object to keep certain basic use cases dead simple e.g. setting the storage engine. That said I suspect there may be some way to expose a functional primitive around transforms and serialization.

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.