hyperstart / hyperapp-devtools

Developer tools for Hyperapp projects.
GNU General Public License v3.0
27 stars 3 forks source link

Implemented time travel, without any good rules. #2

Closed mrozbarry closed 6 years ago

mrozbarry commented 6 years ago

You're telling me you build a time machine...from a Delorean?

Note

What

To do

Ticket

GIF

Mytrill commented 6 years ago

I have been thinking about the rewrite state issue, and I may have a simple, yet powerful idea:

This way, time travelling is nothing more than a regular action, and the user see their time travels all in one timeline and can go back over and over.

What do you think?

mrozbarry commented 6 years ago

I've got some mixed feelings. So I like the idea that we essentially make time travel history, but it also has the potential to grow the history, and big arrays in js usually mean poorer performance. You do, however, support grouping, so maybe that will minimize a lot of it.

Another option for writing different histories is to use your run-instances concept. If you time travel and start editing, the debugger behaves as if you started a new debug run. The nice thing about that is we are preserving initial state of the new timeline, won't have multiple paths to think through during replay, and maybe aligns better with the concepts in the debugger that are already implemented.

Mytrill commented 6 years ago

The runs feature actually comes from the hyperstart.io: there, all the previous runs are kept and can be explored (and soon, time travelled to...)

So I am not sure I am happy re-using this concept for time-travel.

Maybe we need a new concept/thing for this? You oppose to have the time travel as an action purely because of performance reasons (in which case, we could provide support for removing actions beyond a certain point) or because of concept reasons?

mrozbarry commented 6 years ago

Sorry, I'm not opposed to it, just hesitant.

Let me look at the how the data is going to look (in a broad sense):

That's not actually too bad. 👍

Maybe we want a special way to display timetravel so it's more obvious as a new app state. Not sure if that means just a little css and colour, or something else.

But okay, I can definitely get behind this. I guess a part of me still thinks through the lens of my debugger, which as a slider, which meant a huge amount of timetravels (no direct jumping to a state like in yours).

Mytrill commented 6 years ago

Hum, now that I see I am actually not sure I like it so much... :D

Maybe we can implement it this way for now since it should be very straight forward (maybe some extra css as you said) because it will still provide a lot of value, and then later we can review this feature...

What do you think?

mrozbarry commented 6 years ago

Yeah, we can definitely take an iterative approach. I'll get that sorted out tonight (UTC-5), and finish up the PR.

mrozbarry commented 6 years ago

Okay, this should be good to go :)

Mytrill commented 6 years ago

If I understand the PR properly, selecting an action automatically time-travels to it.

Should we make it a separate action? I find myself often inspecting previous states/actions to debug issues but I rarely time-travel to them.

What do you think?

EDIT: Actually I am ok with this (at least for now, may add a "time travel to" button, only visible when hovering over the action, or only visible on a selected action).

Thanks for the PR!