Skip to content
New issue

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

[RFC] Moving to a single rehydrate action #12

Closed
rt2zz opened this issue Sep 30, 2015 · 4 comments
Closed

[RFC] Moving to a single rehydrate action #12

rt2zz opened this issue Sep 30, 2015 · 4 comments

Comments

@rt2zz
Copy link
Owner

rt2zz commented Sep 30, 2015

Redux Persist currently emits several rehydration actions: one for every reducer. It was designed this way because it directly reflects the way redux persist works under the hood, on a per reducer basis. However we could just as easily merge every persisted value into one single 'initial state' object and fire a single REHYDRATE action.

Pros:

  • less noise in action log
  • makes writing custom auto-rehydration functions easier
  • can potentially remove REHYDRATE_COMPLETE action

Cons:

  • Dealing with nested data can be error prone in custom rehydration handlers

Thoughts?

@zalmoxisus
Copy link
Contributor

Does it mean that the rehydration key will not match the reducer key anymore? It is not a big problem I guess, we may just catch them by payload parameters. I'd opt for less noise.

@rt2zz
Copy link
Owner Author

rt2zz commented Oct 12, 2015

@zalmoxisus yes, there would no longer be a reducer key on the action.

By less noise, do you mean you would prefer it was consolidated to one action?

@zalmoxisus
Copy link
Contributor

Yes, having a lot of reducers could generate a lot of rehydate actions in the devtool, making it difficult for debuging.

Also REHYDRATE_COMPLETE is a bit ambiguous as it is invoked only after the initial rehydratations. If we use something like persist-crosstab, one would expect to have REHYDRATE_COMPLETE when new rehydratations occur as well.

Though I agree that dealing with nested data can be error prone in custom rehydration handlers.

@rt2zz
Copy link
Owner Author

rt2zz commented Nov 18, 2015

Will most likely make the switch in 2.0. This creates better symmetry with the getStoredState api and reduces log noise.

Will deal with the "debugability" question with a debug option.

@rt2zz rt2zz closed this as completed Nov 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants