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: Effects should not be triggered when using time travel debugger #1062

Closed
rstraub opened this issue May 13, 2018 · 2 comments
Closed

RFC: Effects should not be triggered when using time travel debugger #1062

rstraub opened this issue May 13, 2018 · 2 comments

Comments

@rstraub
Copy link

rstraub commented May 13, 2018

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[X] Feature request
[ ] Documentation issue or request

What is the current behavior?

Currently when you use the effects module and you use the time travel debugger the effect is triggered when replaying. This can for instance cause http requests to trigger again. In turn this causes the state to differ between the first "recording" of the app state and after replaying since it calls the endpoint during each replay.

This is my client after clicking through the first time manually. I added a new item to my list called "Create feature request for NgRx". This makes a call to the server. The result is this:
screen shot 2018-05-13 at 13 36 56

If I then replay using the time travel debugger, I end up with this:
screen shot 2018-05-13 at 13 38 46

It is clear to see that it actually added the record again, mutating the state and possibly causing different behaviour between manually editing state and afterwards replaying it.

Expected behavior:

I would expect the triggered effects not to be invoked during replay with the time travel debugger. This keeps the clients state consistent during replays and prevents weird behaviour dependent on the side effect model (like an http request returning an error the second time an endpoint is invoked).

My request is to ignore effects when replaying and only replay downstream actions like a success or failure which don't mutate state outside of the application's context.

@rstraub rstraub changed the title Effects should not be triggered when using time travel debugger RFC: Effects should not be triggered when using time travel debugger May 13, 2018
@dummdidumm
Copy link
Contributor

dummdidumm commented May 14, 2018

To my knowledge this is not possible because it is not clear to the app where the actions come from. But you can "ignore" all new actions and state changes once #955 lands using "lock".

Related: #822

@brandonroberts
Copy link
Member

Duplicate of #822

@brandonroberts brandonroberts marked this as a duplicate of #822 May 26, 2018
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

3 participants