156663
Something that I've noticed with the Firki previewer that's bothered me a bit is:
a. it makes requests to interpret for basically every key event/character typed which I imagine is fairly wasteful, and
b. given that there will be a bunch of interpret requests in flight while typing and they can finish in any order, sometimes what ends up happening is that the Firki preview doesn't actually show you the most up-to-date preview if one of the earlier interpret requests actually ends up coming back after the actual last request resolves (this is the actual bug).
To fix that, there should a) be some debounce on when the preview request gets sent while typing, and b) only be one interpret going at a time (i.e. cancel any ongoing requests if typing before it's done).
I went ahead and played around with the code and made some changes to do just that, if you don't mind: https://pastebin.com/JLjUjS8J (new lines are commented, obviously feel free to do whatever you want with those)
(also I forgot how dumb and painful non-ES6 JS is without arrow functions and all, but I wanted to stay at the same compatibility level, so here I am)
a. it makes requests to interpret for basically every key event/character typed which I imagine is fairly wasteful, and
b. given that there will be a bunch of interpret requests in flight while typing and they can finish in any order, sometimes what ends up happening is that the Firki preview doesn't actually show you the most up-to-date preview if one of the earlier interpret requests actually ends up coming back after the actual last request resolves (this is the actual bug).
To fix that, there should a) be some debounce on when the preview request gets sent while typing, and b) only be one interpret going at a time (i.e. cancel any ongoing requests if typing before it's done).
I went ahead and played around with the code and made some changes to do just that, if you don't mind: https://pastebin.com/JLjUjS8J (new lines are commented, obviously feel free to do whatever you want with those)
(also I forgot how dumb and painful non-ES6 JS is without arrow functions and all, but I wanted to stay at the same compatibility level, so here I am)