-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
throttle
operator throws error RangeError: Maximum call stack size exceeded
#6034
Comments
I was hoping I could workaround it like so: -throttle(() => Rx.EMPTY, { leading: false, trailing: true })
+throttle(() => Rx.scheduled(Rx.EMPTY, Rx.async), { leading: false, trailing: true }) … so it completes asynchronously rather than synchronously. However IIUC this doesn't work because of another bug with |
Note this issue only occurs when |
In RxJS v7 beta, the behaviour is different but still incorrect (at least in my mind): https://stackblitz.com/edit/rxjs-compat-mmjf6c. This never logs anything. Update: never mind, see #6034 (comment). |
That's the behavior that I would expect: given the fact that What's the behavior that you were expecting? |
My understanding was that if |
I could be completely wrong, of course, but what I would expect from |
Another weird discovery: in v7.0.0-beta.10 this doesn't throw an error but it does still log import * as Rx from "rxjs";
import { throttle } from "rxjs/operators";
const source = Rx.of(1).pipe(
throttle(() => Rx.of(1), { leading: false, trailing: true })
);
source.subscribe(x => console.log(x)); https://stackblitz.com/edit/rxjs-compat-vswz6n If someone can confirm this is not expected behaviour, I can try to send a PR with a test and a fix. If I understand correctly, this is the expected behaviour as @josepot says:
So
Ah, I believe this is because of this change: 4af0227. In my example the duration selector never emits anything, it only completes. That makes sense. |
The original bug is fixed in 7.0.0. However, the bug reported here is still outstanding. It begs the question "why would anyone do this?" but it still needs to be fixed. |
Closing this, as it's fixed in 7. I'm uncertain that this needs fixed in 6, as it's sort of an edge case, but I'm happy to reopen it and take anyone's PR on the matter if they want to put in the time. |
Other issue is here: #6058 |
RxJS version:
6.6.3 (latest at time of writing)
Code to reproduce:
https://stackblitz.com/edit/rxjs-compat-ywrxqr
Expected behavior:
It logs
1
once.Actual behavior:
It logs
1
many times and then errors withRangeError: Maximum call stack size exceeded
.Additional information:
The reduced test case is a bit contrived. In practice my duration selector has a bit more logic:
The text was updated successfully, but these errors were encountered: