d3 / d3-transition

Animated transitions for D3 selections.
https://d3js.org/d3-transition
ISC License
223 stars 65 forks source link

transition.end() never resolves if 0 elements are matched #105

Closed chahu closed 4 years ago

chahu commented 4 years ago

The subject says it all. I was debugging some more complex d3 code and this behavior turned out to be the culprit. Here's a stripped down example.

https://codepen.io/chahu/pen/KKdomVZ

Fil commented 4 years ago

In that case no schedule has been set on any node, there is nothing to end. We should probably resolve immediately (as in https://github.com/d3/d3-transition/pull/108), but it might not the behavior you would expect if you'd set a fixed duration.

chahu commented 4 years ago

Thanks for looking into this. Based on #108, resolving immediately seems more consistent, but either behavior is reasonable in my eyes.