preactjs / preact-www

:book: Preact documentation website.
https://preactjs.com
MIT License
358 stars 500 forks source link

Limit runner delay to user input #1159

Closed rschristian closed 3 months ago

rschristian commented 3 months ago

The REPL runner has a 500ms timeout on code change, which is well and fine for user input (a tad high for my liking perhaps, but avoids noisy & useless errors) but less so when say switching REPL examples or tutorial pages. On the REPL especially, as some examples need to pull additional modules from esm.sh, this feels rather laggy and slow.

https://github.com/preactjs/preact-www/blob/fa8a917e9804292344f1da68794833f1a0c15b36/src/components/controllers/repl/runner.jsx#L69-L85

Off the top of my head, probably best to move this timeout into consumers of the REPL runner, let them control the timeouts as they can better discern user input from controlled swapping of runner code.