decomp.me
decomp.me copied to clipboard
Improve automatically recompile on change feature
This feature seems a bit too aggressive as to when it chooses to send an outgoing compile request - it often does so while the user is in the middle of typing. It might be worth exposing a slider in the preferences that allows the user to set a millisecond delay between the last keystroke and an automatic recompilation.
There's also a bug where sometimes a response will come back while the user is still typing and the front-end doesn't seem to think it needs to send out a new request, so the user has to manually invoke a compilation.
I'm not able to reproduce the bug of simultaneous request/response. Any hints on what exactly causes this?
~~I'm pretty sure I fixed that bug a while back @MonsterDruide1~~
Okay, if that part got fixed, the mentioned PR can be marked as "linked" to close this issue on merge.
No, the bug hasn't been fixed. There are times where, if the site is waiting for an incoming compile result and the user types before the result comes back, the client doesn't send out another request. I don't have a super easy way to reproduce it
Ah, so if a new request would be queued while the old one is still processing? To test it, one possible thing is to mock a slower server or slower network speed. How could I do that? Inserting a wait inside the compiling processing function on the backend?
We can fix this by writing this hook ourselves to keep eating repeated calls and only send out the request after n ms has passed. Perhaps { leading: true, trailing: false }
would exhibit this behaviour, I'm unsure
https://github.com/decompme/decomp.me/blob/b378a2f84278287fc3f522612799b75434b922f7/frontend/src/lib/api.ts#L399
I can reproduce this as suggested, using the "Latency"-emulation by Google Chrome. It's still an issue, and I'm working on resolving that. However, as I started a custom implementation of DebouncedCallback
, it might still take a while before it's finished, so I think this has to go into a separate PR from #353 .