-
Notifications
You must be signed in to change notification settings - Fork 40
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
Track nested changes #3
Conversation
Originally, I thought that reports for actions doesn't have Before, we either show the action before the updates and display an inconsistent state, or show it after the updates (with the final state) and miss the point when an action is started. As everything except scheduled reactions has Also, in that implementation neither toggling nor time travelling will not work correctly when having more than one intermediate update, as the action state is not final. |
Tried with examples, and it's amazing! Unfortunately, we'll not be able to dispatch actions remotely and autogenerate tests for nested observables. I would suggest to use this under a flag, let's say |
I was thinking about a flag too :) . @zalmoxisus do you use gitter? I wish for something more interactive because I think we need to clear a thing or two. I'm not sure about the intermediate actions you're mentioning. The Also what's the problem of dispatching actions remotely if they are just functions? |
It can be disabled using
I meant those things like splice you mentioned. Let's call them intermediate updates, and actions would be only functions with
When I dispatch
In case of actions it's easy, but when they are not used, how will we know when there are no more changes to be applied?
Yeah, feel free to ping me there, but still better to keep all the discussion here in case some one else has any suggestions. |
It's a bit a more clear now. Thank you. I think there are 2 distinct scenarios:
In strict mode, nobody will want to see intermediate actions. I think we agree on this, right? The developer would expect timetravel to move through actions, not intermediate changes. In contrast when not using strict mode you will always want to see intermediate actions. Therefore the About
What do you mean by that? The reaction will trigger once the observable changes and this is when the actions will be send to the extension. Is there a problem that I'm not seeing? And the last thing you pointed out is generating tests. Can you give me a simple scenario where nested store wouldn't work? Even if that is the case, shouldn't we focus on the main goal of the extension - to help debug. Generating tests is a perk, not the main goal. Comparing nested feature VS tests I would go with nested to be default and if people want tests to enable non-nested behaviour. Thoughts? |
PS: |
There would be still useful to investigate changes for performance reason. There could be hundreds of changes in one action. Also, even in strict mode, the async changes can be outside the action (if
We better discuss it later, or you can try to implement it. Dispatching
Then it should work great.
Action |
Thanks for the info! We can then use |
I'm testing things. Seems like even the current code (before my pull request) doesn't handle async actions.
If a new actions is run before the previous async competes you will get it in the middle of |
@antitoxic, don't see how this could happen, should be other problem there. Any steps to reproduce it? Modified this line with: this.props.store.increment();
this.props.store.incrementAsync();
this.props.store.increment(); and works well regardless if changes are wrapped in Is the same problem present in |
@antitoxic, that issue should be fixed in 9aca4ab. I've just published a new version of the extension, and we're ready for Thanks to @mweststrate, now we can call Regarding this PR:
|
Added another implementation without using reactions in #5. |
I'm getting back into this :) Few things:
|
Yes, it makes impossible only skipping actions and test generation. Also it makes debugging useless in some cases. For example, you will not be able to figure out why your |
That's true. It's easier if it's part of a object because there is no parameters, but couldn't we just dump the state as JS object and get stacktrace? That should be enough to find out how to call |
Yes, for |
I'm trying to figure out the purpose of:
And when I run:
This is what I see: So Is this the supposed visual output? |
To clarify: I'm asking the above in relation to async actions. I understand the purpose for sync actions. |
I think yes.
Yes, we could skip them, modifying the slider monitor. Also we could modify the inspector monitor to make them collapsable if that makes sense. However, the recommended way is to use strict mode, and then we'll see just actions names. |
After some digging, I am pretty sure mobx makes it impossible to know all the stores that an action alters (cc: @mweststrate). By which I mean there is no way to figure out all affected parent observables even if we have reference to the currently affected observable. That's kind of sad. Relying on reaction has proven to be uncapable of tracking async actions that are just that - async, no sync changes. I'm closing this. Please reopen if you have other ideas. I will now open a new pull request - #6 . Very simple one - an option to set a "global default store" which will be used to capture and show all uknown changes in the remotedev extension. |
As per #2 this enables tracking nested changes without explicitly wrapping them in
remotedev()
.A few notes:
send()
was removed. I brought it back. It's used. I need feedback on this.was doing. I removed it. I need feedback on this. However to me this doesn't make sense.