Rxjs: debounce/debounceTime events bug?

Created on 4 Apr 2016  路  6Comments  路  Source: ReactiveX/rxjs

RxJS version:
beta 4
Code to reproduce:

Input$ //observable of keyboard events
      .do( x=> console.log(x))
      .debounceTime(1000)
      .do( x=> console.log(x))

result:
image

Expected behavior:
The event object to be passed as it was received

Actual behavior:
All values are passed as null

Additional information:
with throttleTime it works as expected

Input$  //observable of keyboard events
      .do( x=> console.log(x))
      .throttleTime(1000)
      .do( x=> console.log(x))

image

EDIT: Idem with debounce.

Most helpful comment

SyntheticKeyboardEvent <--

This is because you're using React. In React, you need to call e.persist() on events or they will mutate.

For more information see the React documentation

All 6 comments

Seems like a legit bug IMO. @kwonoj @blesh this is interesting, it seems those properties are lost just because the value this.lastValue is stored as a property of DebounceTimeSubscriber https://github.com/ReactiveX/rxjs/blob/master/src/operator/debounceTime.ts#L71 while in RxJS v4 the value x is passed to the scheduled dispatch through the closure: https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/linq/observable/debounce.js#L45

yes, interesting. I'll look this on my end too.

@rickmed I assumed you used Chrome. But which version?

@staltz Version 49.0.2623.110 m

SyntheticKeyboardEvent <--

This is because you're using React. In React, you need to call e.persist() on events or they will mutate.

For more information see the React documentation

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

benlesh picture benlesh  路  37Comments

benlesh picture benlesh  路  31Comments

alexeagle picture alexeagle  路  36Comments

benlesh picture benlesh  路  46Comments

benmonro picture benmonro  路  32Comments