decomp.me icon indicating copy to clipboard operation
decomp.me copied to clipboard

Improve automatically recompile on change feature

Open ethteck opened this issue 3 years ago • 7 comments

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.

ethteck avatar Jan 06 '22 14:01 ethteck

I'm not able to reproduce the bug of simultaneous request/response. Any hints on what exactly causes this?

MonsterDruide1 avatar Feb 10 '22 20:02 MonsterDruide1

~~I'm pretty sure I fixed that bug a while back @MonsterDruide1~~

bates64 avatar Feb 11 '22 12:02 bates64

Okay, if that part got fixed, the mentioned PR can be marked as "linked" to close this issue on merge.

MonsterDruide1 avatar Feb 11 '22 12:02 MonsterDruide1

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

ethteck avatar Feb 11 '22 12:02 ethteck

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?

MonsterDruide1 avatar Feb 11 '22 12:02 MonsterDruide1

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

bates64 avatar Feb 11 '22 12:02 bates64

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 .

MonsterDruide1 avatar Feb 16 '22 10:02 MonsterDruide1