throttle stream search events instead of debouncing
Created by: camdencheek
This fixes an issue with our streaming search rendering pipeline that was, in some cases, causing no results to be rendered until the entire search was complete.
When reducing the stream of search events, we were rate-limiting the
number of UI updates by piping them through debounceTime
. The problem
with debounceTime
in this case is it will not emit an event until the
configured time has passed and there have been no events observed. With
streaming search though, we are sending a progress event every 100
milliseconds, so the condition to emit an update event was never met. In
effect, this made it so no results were rendered on the page until the
search was complete, after which 500 milliseconds would pass and the
page would render.
This commit replaces debounceTime
with throttleTime
, which, instead
of waiting for a period of no events, always emits an event after the
interval if the value has changed. This change significantly improves
the time to first rendered results.
Before:
After: