I’d like to propose adding a trailing option to phx-throttle so that the final event in a burst is always delivered — similar to throttling utilities in other ecosystems.
What I’m suggesting
phx-throttle currently limits how frequently events are pushed, but it does not ensure that the last event will be sent within the throttling window.
I’m proposing an optional flag such as:
phx-throttle="200" phx-throttle-trailing
(or trailing=“true” depending on conventions)
which would guarantee that after throttling settles, the most recent event is emitted.
Why this matters in real-world LiveView apps
In many cases, developers choose debounce for inputs, but the downside is that it delays the UI response. For example:
-
typing into a search box
-
adjusting a slider
-
interacting with fast-changing inputs
Debounce waits until the user stops typing, which means the UI feels less responsive.
On the other hand, throttle emits the first event immediately, giving users instant feedback, while still reducing server load. But without a trailing event, we lose the final accurate state, which is often essential for real-time interactions.
A trailing option would let us enjoy the best of both worlds:
-
fast first response → smoother UX and more responsive LiveView apps
-
controlled message rate → reduced load on the server
-
final correct value → no need for hacks like extra phx-blur events or custom JS hooks
I believe this would significantly improve customer experience in LiveView applications, especially in dynamic, interactive UI scenarios.
Thanks!






















