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 recently update from version 6.6 to version 7.5. I found some infinite loop in my code due to throttleTime that didn't work as it used to. We are calling in our subscribe some method that may emit new value on the subscribed observable. throtteTime filtered those values, but it let them pass in version 7.5.6 . Now it behave as it was only synchronous.
Expected behavior
throttleTime should still ignore subsequent sources even if they were emitted in subscribe.
In version 7.5.6 the throttleTime uses throttle operator with a timer.
Checking throttle code, I noticed that in the example above, the subscriber will keep sending values to the source, making the calls to stack and process before subscribing to the timer.
if (hasValue) {
// Ensure we clear out our value and hasValue flag
// before we emit, otherwise reentrant code can cause
// issues here.
hasValue = false;
const value = sendValue!;
sendValue = null;
// Emit the value.
subscriber.next(value); // <-- here it'll call send values to the source, which will make it triggers the send again;
!isComplete && startThrottle(value); // <-- startThrottle won't be called for the next call;
}
Checking if the throttled is set before the next call would make it work properly.
I added this code: hasValue && !throttled && startThrottle(sendValue as any); locally and ran some tests and it worked as before.
But running npm test I get some !!!, which, forgive my ignorance, but I don't know what they mean.
Describe the bug
I recently update from version 6.6 to version 7.5. I found some infinite loop in my code due to throttleTime that didn't work as it used to. We are calling in our subscribe some method that may emit new value on the subscribed observable. throtteTime filtered those values, but it let them pass in version 7.5.6 . Now it behave as it was only synchronous.
Expected behavior
throttleTime should still ignore subsequent sources even if they were emitted in subscribe.
Reproduction code
Reproduction URL
No response
Version
7.5.6
Environment
node 14.19.3
typescript 4.6.4
Additional context
No response
The text was updated successfully, but these errors were encountered: