If the browser decides to defer the rendering of the frame for some reason, the echo from keystrokes can become somewhat sluggish, which can create visible latency in the experience.
In my tests, if we have a awaitingEcho boolean state that is set to true whenever we send to stdin, and then trigger a synchronous render when that is true (and immediately set it to false again), results in a much more responsive experience, and since we only do it when waiting for an echo, it shouldn't have any impact in the performance when there's a lot of content coming from stdout.
If the browser decides to defer the rendering of the frame for some reason, the echo from keystrokes can become somewhat sluggish, which can create visible latency in the experience.
In my tests, if we have a
awaitingEchoboolean state that is set to true whenever we send to stdin, and then trigger a synchronous render when that is true (and immediately set it to false again), results in a much more responsive experience, and since we only do it when waiting for an echo, it shouldn't have any impact in the performance when there's a lot of content coming from stdout.