platform icon indicating copy to clipboard operation
platform copied to clipboard

Component-store: Debounce stops working correctly with RXJS 7.5.x

Open aldrashan opened this issue 2 years ago • 2 comments

Minimal reproduction of the bug/regression with instructions

Will try to create a minimal example that displays the problem later. Our code library isn't quickly exportable right now. https://stackblitz.com/edit/rxjs-htf8tz?file=index.ts should show this as well (from the issue linked below).

Minimal reproduction of the bug/regression with instructions

See https://github.com/ReactiveX/rxjs/issues/6747. I too traced our issues down to the asapScheduler that's used in the debounceSync function. https://github.com/ngrx/platform/blob/master/modules/component-store/src/debounce-sync.ts -> Line 53: observer.next(actionValue); is never hit in some cases

Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)

NgRx: 14 Angular: 14 Node: n/a Browsers: n/a OS: n/a

Other information

No response

I would be willing to submit a PR to fix this issue

  • [ ] Yes
  • [X] No

aldrashan avatar Aug 30 '22 14:08 aldrashan

I don't think we can do anything about it - it's a broken upstream dependency.

alex-okrushko avatar Sep 04 '22 14:09 alex-okrushko

Replacing asapScheduler.schedule with queueMicrotask would most likely solve this issue. If the asapScheduler bug is not resolved soon, we can investigate alternatives.

markostanimirovic avatar Sep 07 '22 21:09 markostanimirovic

Any updates on this issue? What's the recommended workaround? { debounce: false }?

Thanks

Samoji avatar Nov 03 '22 14:11 Samoji

Any updates on this issue? What's the recommended workaround? { debounce: false }?

Thanks

Debounce: false isn't really a valid workaround, since you're changing how the code works. If it works without debouncing, you didn't need it to begin with.

The people from rxjs closed the issue about what was/is causing problems, since it "should" be fixed starting from 7.5.7, but this is still not the case for our project.

aldrashan avatar Dec 15 '22 10:12 aldrashan

Any update?

thomastrapanese avatar Mar 15 '23 10:03 thomastrapanese

Any update?

They (the people from rxjs) have -allegedly- fixed it for their next release but it hasn't come out yet. Should be fairly soon, seeing how they've been releasing a new version every 2-4 months and it's been 3 months. They were also planning on porting the fix to older rxjs versions as well, so fingers crossed until their next release, I guess.

aldrashan avatar Mar 15 '23 11:03 aldrashan

Thank you @aldrashan

thomastrapanese avatar Mar 15 '23 11:03 thomastrapanese

@thomastrapanese Rxjs version 7.8.1 came out a few hours ago. Seems fixed after some preliminary testing. Will close this issue in a few days if we don't encounter any more problems.

aldrashan avatar Apr 27 '23 07:04 aldrashan

It seems this issue is fixed in RxJS v7.8.1.

markostanimirovic avatar May 05 '23 15:05 markostanimirovic