GithubHelp home page GithubHelp logo

Comments (5)

bjoluc avatar bjoluc commented on May 18, 2024 3

Hi, glad to hear you're still interested; I absolutely do have plans and am currently working on a full rewrite! Unfortunately, I didn't manage to finish it in the semester break which is why it might still take a few month in the worst case (hopefully not). Here are my plans:

  • Move away from redux-persist and redux-persist-cookie-storage as the machinery is pretty heavy for the simple task and redux-persist-cookie-storage doesn't seem to be maintained. redux-cookies-middleware seemed to be a good alternative at first, but it has not been maintained for a while now as well. Hence, I'm currently building a tiny custom Redux middleware for the use case. This also allows us to tackle #2 with a warning in dev mode.
  • Change the interface: I never really liked the "wrapping next-redux-wrapper" part. It couples the two packages quite tightly. With a custom middleware in place, wrapping the makeStore function is all it takes, I guess.
  • The HYDRATE reducer: I think we can make it such that people do not need to alter it for next-redux-cookie-wrapper. Instead, we can do some magic in our middleware:
    • In the getServerSideProps case, we always want the latest cookies from the server to take precedence. We do not have to merge anything as the server also has the client state (ignoring the time between request and response here where the client state might potentially change).
    • In the getStaticProps case, the server does not have client cookies available and incoming state (from the server) in the client can by default be ignored (i.e., the client state remains unaltered). However, there may also be use cases that require custom handling in the HYDRATE reducer, so this must still be possible.

What do you think; any mistakes in my assumptions? If you find something odd or know better alternatives, please let me know! :)

from next-redux-cookie-wrapper.

VictorPulzz avatar VictorPulzz commented on May 18, 2024 1

@bjoluc Thank you for job! One small question, How will you organize the nested persist reducers. I mean the following: let's say we have a store with nested data:

root: {
  user,
  messages
  ... etc
}

Let's say for a user I store data in a cookie.
I messages I store localStorage.
How can I pass this nesting?

from next-redux-cookie-wrapper.

github-actions avatar github-actions commented on May 18, 2024 1

🎉 This issue has been resolved in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

from next-redux-cookie-wrapper.

bjoluc avatar bjoluc commented on May 18, 2024

@VictorPullzz Hey! Well, currently you should be able to use something like

persistConfig: {
    whitelist: ["root.user"],
},

when you call withReduxCookiePersist. I did never try the current version of next-redux-cookie-wrapper alongside a plain redux-persist setup though, nor do I expect that to work. In the next version, however, this should work without any problems since redux-persist is off the next-redux-cookie-wrapper dependencies then. I guess we'll have something like a subtrees config option then where you can add "root.user" to be synced with cookies.

from next-redux-cookie-wrapper.

VictorPulzz avatar VictorPulzz commented on May 18, 2024

@VictorPullzz Hey! Well, currently you should be able to use something like

persistConfig: {
    whitelist: ["root.user"],
},

when you call withReduxCookiePersist. I did never try the current version of next-redux-cookie-wrapper alongside a plain redux-persist setup though, nor do I expect that to work. In the next version, however, this should work without any problems since redux-persist is off the next-redux-cookie-wrapper dependencies then. I guess we'll have something like a subtrees config option then where you can add "root.user" to be synced with cookies.

Thanks for answer!
I hope that you will be able to upgrade to the new version of next-redux-wrapper :)
I'm currently trying to connect your plugin and next-redux-wrapper v6, but so far there is little progress :D

from next-redux-cookie-wrapper.

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.