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

Replay mode #140

Closed
amannn opened this issue Jun 16, 2016 · 7 comments
Closed

Replay mode #140

amannn opened this issue Jun 16, 2016 · 7 comments

Comments

@amannn
Copy link

amannn commented Jun 16, 2016

First of all, really great work on this extension! I use it almost daily when working on Redux apps.

I'm encountering an issue, when using the time travel feature of the dev tools. The problem mostly comes down to a view reacting to a state change and dispatching another action. The problem is pretty well described in issue 167 from redux-devtools.

I was wondering if this could somehow be solved by this extension?

I guess there should be some kind of replay mode that is entered when the action history is changed through the dev tools. As redux-devtools-extension is injected as a store enhancer, would it be possible to prevent new actions reaching the reducers? Otherwise, maybe a dev tools middleware could be added that has this behaviour?

Thanks!

@zalmoxisus
Copy link
Owner

This should be implemented in redux-devtools-instrment, but only after Redux 4.0 with new API for store enhancers is released. A possible solution was suggested before.

@rybon
Copy link

rybon commented Jun 23, 2016

My suggestion would be to make the rendering itself not cause any side effects. A render is basically always triggered by a dispatch and having another dispatch triggered as a result of that seems wrong. Before you know it, you have a cascade of state mutations and / or side effects going off from a single dispatch and you'll lose track of which dispatch caused what. It will also make things hard to test. This problem is what made large Backbone applications hard to manage.

React and Redux are designed to get away from that. In the Redux render loop there is only one event (change) and only one subscriber (React). To keep that contract for rendering intact, I would not trigger any dispatch in a life cycle method of React (or React Router). Instead, have a look at Redux Saga or something similar.

zalmoxisus added a commit that referenced this issue Jul 15, 2016
zalmoxisus added a commit that referenced this issue Jul 15, 2016
zalmoxisus added a commit that referenced this issue Jul 15, 2016
@zalmoxisus
Copy link
Owner

Implemented in v2.3.0. See the description and the example of usage.

@amannn
Copy link
Author

amannn commented Jul 18, 2016

Looks great! Are you planning use the isTimeTraveling feature in the chrome extension for the slider monitor?

@zalmoxisus
Copy link
Owner

@amannn, yes, it is used for side effects to disable them when time traveling. See #145 for more details.

@ccorcos
Copy link

ccorcos commented Aug 1, 2016

@zalmoxisus it would be great if we could import just an array of actions. the states should be reproducible and this way, we could save tracking data thats captured from elsewhere and replay exactly what happened. how does that sound to do? I'm happy to help!

@zalmoxisus
Copy link
Owner

@amannn, there's a better way now to prevent side effects like those while time travelling. It will also help to lock changes for the us case of @ccorcos. See the post for details on how to get it.

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

4 participants