Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Proposal: Support time-travel debugging (still editing) #4529
tldr; We should support time travel debugging. People should be able to go back to a previous state.
There are a few things we need to be able to do:
Record all state changes
As we have two different types of observables (objects and single-value) we need to store different things:
Set state changes without causing side effects (except for updating the DOM or URL).
This is the hardest part. Ideally, we could simply update every observable with its value
This will not be easy because we need some things to run their side effects:
We could differentiate these listeners from normal "side-effect" listeners. Maybe the MUTATE queue is this differentiator.
Here we will record only the first state changes that causes the queues to start. These are "root causes". Queues already knows when this happens because there is no
We store these and can play setting the opposite value in reverse.
What if a component is created and does something like:
Upon playing "forward",
Essentially, while playing forward, any "root causes" that happened as as result of us updating the state, we would ignore when performing the next step.
I've tried to pencil out what a "slow mode" queues system would look like. "Slow Mode" would run tasks exactly the same as the current synchronous queues system, except it would allow time between each task.
This was not an easy task. There were challenges mimicking the exact nature of the queues. I think this might be impossible. Impossible largely because any
I don't think a "slow-mode" queue is necessary for time-travel debugging because we won't need to be that fined grained. However, it would be nice for some difficult to figure out bugs.
I don't know how much people want to debug microscopically vs macroscopic
MICRO: say someone clicks a button, and they want to break down everything that happens as a result of that bug click ... as values get passed from one component to another. This is what
MACRO: You click one button, then another button, then submit a form, then do something else. We can do time travel for these things.