You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I suspect this issue is related to #2 , but since that thread is specifically about supporting pullables, I thought perhaps a separate issue would do better.
The Issue
Last emitted value is not flushed. Basically the completion signal masks the last value received.
At the emission time for completion signal, also emit latest value.
I: -----(A)----- | ----- | -----(B)----- X
O: ----- | ----- | -----(A)----- | ----- | ----- | ----- (B) X
👉 debounce wait is 2. B is emitted 2 units after completion signal, alongside completion signal.
e.g., the timeout is reset because of completion signal, but last value is also emitted.
At the debounced time for last emission, emit completion if completion signal is received in the meanwhile.
I: -----(A)----- | ----- | -----(B)----- X
O: ----- | ----- | -----(A)----- | ----- | -----(B) X
👉 debounce wait is 2. B is emitted 2 units after source emits B, alongside completion signal.
e.g. the timeout is not reset because of completion signal, but it will be emitted alongside last value.
Reasoning
debounce() is (IMHO) the most applicable delay operator, simply because it always emits the latest value (for example throttle() actually loses latest values, etc). However, the current implementation is lossy in edge cases, which takes
away that applicability.
Debouncing in higher-order streams typically looks like this:
Which does not work with current implementation and would need a separate, delay only operator. It would be much more intuitive if you would not need to change the used operator for debouncing between these two situations.
P.s. in case you are wondering why would someone debounce in a higher-order stream, it is typically for situations where you want to conditionally debounce.
The text was updated successfully, but these errors were encountered:
I suspect this issue is related to #2 , but since that thread is specifically about supporting pullables, I thought perhaps a separate issue would do better.
The Issue
Last emitted value is not flushed. Basically the completion signal masks the last value received.
Example
In this example, nothing is logged.
playground
Proposed Behavior
I could think of two alternatives:
Reasoning
debounce()
is (IMHO) the most applicable delay operator, simply because it always emits the latest value (for examplethrottle()
actually loses latest values, etc). However, the current implementation is lossy in edge cases, which takesaway that applicability.
Debouncing in higher-order streams typically looks like this:
Which does not work with current implementation and would need a separate, delay only operator. It would be much more intuitive if you would not need to change the used operator for debouncing between these two situations.
The text was updated successfully, but these errors were encountered: