Closed smnandre closed 6 months ago
And i discoverd this page explaining the difference between throttle & debounce with some sweet interactive demo.... really nice ! 🥇
It should be reasonable to add if we want it. If the main use-case is avoiding double-submits, another option might be to disable a button that is connected to a LiveAction
until the request finishes. Turbo, iirc, does that.
The main problem with that is ... some users may double click slower than the request is handled.
Some users with trackpads may "double click" with up to 500ms... and a great server could answer in 50ms :/
I tried the addAttribute(disabled)
but it did not work.
Following your idea, maybe instead of throttle something like "locked" or "frozen" (meaning no other event would be listen/triggerd for a time).. That could be a good generic way to handle this specific use case ?
Thank you for this issue. There has not been a lot of activity here for a while. Has this been resolved?
While playing with the LiveComponent for an upcoming demo, I encountered something I could not resolve. There is a "debounce" modifier, but no throttle.
However, if debounce is the "better option" for something like an autocomplete (the more input, the better the choices suggested to the user), for a button, a throttle would be more suitable in my opinion.
Handling "double click submits" in backend code is something that could be tricky.
Is this something we could easily add/implement, or did I misread the documentation? 🙊"