Jim Meyer
05/27/2022, 2:50 PMreturn (
<div>
</div>
);
User A:
Inserts a new Dialog component, which uses an "open" state to control its rendering.
const [open, setOpen] = useState(false);
return (
<div>
<Dialog open={open} />
<div>
);
Now, an undo by User A at this point would rightly remove both the useState
statement and Dialog
element. But, lets say user B does this before that:
User B:
Inserts an expression that references and displays the open state:
const [open, setOpen] = useState(false);
return (
<div>
<Dialog open={open} />
<h1>Open: {open}</h1>
<div>
);
If User A now wants to undo, removing the open
state would break User B's use of said state.
Are there any examples in research or open source of how to gracefully resolve this? I assume that node based programming could run into this dependency challenge, but I'm unaware of any node based tools that support multiplayer with undo/redo.
One approach I can think of is to check whether there are dependencies on nodes that would be removed by undo, and simply aborting the undo with an error, but I'm curious if there is a more elegant approach.
On a related note, the UI would also have to prevent a traditional delete operation on the open
state, since this would leave the program in an invalid state.Kartik Agaram
Jim Meyer
05/27/2022, 6:17 PMAlex Cruise
05/27/2022, 6:28 PMJim Meyer
05/27/2022, 6:34 PMAlex Cruise
05/27/2022, 6:40 PMJim Meyer
05/27/2022, 6:43 PMAlex Cruise
05/27/2022, 6:44 PMJim Meyer
05/27/2022, 6:49 PMAlex Cruise
05/27/2022, 6:49 PMJim Meyer
05/27/2022, 6:55 PMAlex Cruise
05/27/2022, 6:56 PMJim Meyer
05/27/2022, 6:57 PMAlex Cruise
05/27/2022, 7:27 PMAndrew F
05/27/2022, 11:50 PMJim Meyer
05/28/2022, 5:39 AMopen
state expression that user B added, and then remove the Dialog along with the `open`state that no other elements depend on now.Andrew F
05/28/2022, 6:01 AMJim Meyer
05/28/2022, 6:07 AMKonrad Hinsen
05/28/2022, 8:00 AMChris Knott
05/28/2022, 8:17 AMJim Meyer
05/28/2022, 8:37 AMKartik Agaram