motorcyclejs / dom

The standard DOM driver for motorcycle.js
MIT License
20 stars 2 forks source link

RangeError: Maximum call stack size exceeded #100

Closed Frikki closed 7 years ago

Frikki commented 7 years ago
DOM.select(selector).elements().tap(console.log)

logs [] endlessly until RangeError: Maximum call stack size exceeded.

TylorS commented 7 years ago

I can't seem to recreate this @Frikki

https://esnextb.in/?gist=5a45e425779a42cab5f55e8f014f0dfd

TylorS commented 7 years ago

https://esnextb.in/?gist=5a45e425779a42cab5f55e8f014f0dfd

This demonstrates it, but it's not really an issue with @motorcycle/dom, but an issue with Cycle in general. When you're writing applications you need to be aware of not creating infinite loops like this. It's possible to avoid this error with combinators like .take(1), .skipRepeats(), skipRepeatsWith(compare) or maybe .filter(predicate)

TylorS commented 7 years ago

As per our own private discussion, this is expected behavior. Closing for now