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

Discussion: Implementing more complex re-initialization behavior #4

Closed
steida opened this issue Apr 10, 2016 · 7 comments
Closed

Discussion: Implementing more complex re-initialization behavior #4

steida opened this issue Apr 10, 2016 · 7 comments

Comments

@steida
Copy link

steida commented Apr 10, 2016

Btw http://stackoverflow.com/questions/35622588/how-to-reset-the-state-of-a-redux-store/35641992#35641992

Sometime we need reuse initialState, sometimes currentApp state (for https://github.com/reactjs/react-router-redux for example)

This is just inform issue, to be discussed.

@omnidan
Copy link
Owner

omnidan commented Apr 10, 2016

@steida how is it hard to make reusable? You can use this reducer instead of writing your own, just like described in the stackoverflow post. It will send a @@redux-recycle/INIT action and undefined state (unless you define your own as a third argument)

@steida
Copy link
Author

steida commented Apr 10, 2016

Check usage in Este, sometimes we need initialState, sometimes current state. https://github.com/este/este/blob/0af0e5c826d850514441c12244670bd8636f3d30/src/common/configureStore.js#L92

@omnidan
Copy link
Owner

omnidan commented Apr 10, 2016

@steida I see, well in this case you need to write your own higher-order reducer, redux-recycle is just a small utility function to re-initialize the state on an action 😉

I'll leave this open for discussion, though.

@omnidan omnidan changed the title I think this lib belong to app since it's hard to make it reusable Discussion: Implementing more complex re-initialization behavior Apr 10, 2016
@steida
Copy link
Author

steida commented Apr 10, 2016

I agree, I just want to write somewhere 😅 that sure you can use this for an inspiration only ;)

@arikmaor
Copy link
Contributor

I think the ability to run a reducer to reset could be useful and a good fit here
I've implemented it in #5
comments are appreciated

@omnidan
Copy link
Owner

omnidan commented Jul 25, 2016

resolved through #5 and in 1.2

@omnidan omnidan closed this as completed Jul 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants