Demo does not handle undo/redo events
In the demo on https://jsonnet.org, if you hit redo/undo for multiple characters, the demo breaks. This seems to be because the browser generates multiple text change events (Chrome 139, MacOS 14.6).
Currently, the implementation of the click handler in aux_demo does not synchronize to deduplicate these events, resulting in duplicate or untracked tabs being added to the demo. Because aux_demo calls await (which yields) the DOM call order becomes clear-clear-add-add instead of clear-add-clear-add, resulting in the below behavior.
This can be reproduced by typing two or more keystrokes and then undo (ctrl/cmd + Z).
Example 1
https://jsonnet.org/
https://github.com/user-attachments/assets/e11c5df8-dcda-402e-9caa-f3ee29703fe1
Local fix
I confirmed adding synchronization fixes the behavior locally.
https://github.com/user-attachments/assets/68dc7c35-8594-4221-94de-eda95ad856c4
Example 2
On https://jsonnet.org/
https://github.com/user-attachments/assets/1855eaed-9b17-4ef4-beab-9c438e6f1d47
Local fix
https://github.com/user-attachments/assets/6c9b291e-d7f8-4b1e-a020-7b3aa96b3e9a