Skip to content
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

[d3@6] transition.end() crashes #112

Closed
Fil opened this issue Jul 30, 2020 · 3 comments
Closed

[d3@6] transition.end() crashes #112

Fil opened this issue Jul 30, 2020 · 3 comments

Comments

@Fil
Copy link
Member

Fil commented Jul 30, 2020

d3.transition().duration(1000).end() results in TypeError: undefined is not a function

by bisection (see below) the offending commit appears to be 60be25f8519ecbdf647059719efcd8dee8e50486

Though the commit is in d3-selection, the issue can be fixed in d3-transition by using that.selection().size() instead of that.size() in

var on0, on1, that = this, id = that._id, size = that.size();

This is the solution I'll be pushing in d3-transition@two.

The issue is also isolated in https://observablehq.com/d/c976841fa49523ee, but for bisection it was easier to work wih local files and the following test case:

<body>

<script src="../d3-dispatch/dist/d3-dispatch.js"></script>
<script src="../d3-ease/dist/d3-ease.js"></script>
<script src="../d3-timer/dist/d3-timer.js"></script>
<script src="../d3-selection/dist/d3-selection.js"></script>
<script src="../d3-transition/dist/d3-transition.js"></script>

<script>

(async function() {
  d3.select("body").append("p").html("start");

  await d3.select("body")
  .transition()
  .duration(1000)
  .end();
  
  d3.select("body").append("p").html("end first transition");

  await d3.transition()
  .duration(1000)
  .end();

  d3.select("body").append("p").html("end second transition")

})()

</script>

Issue detected by @enjalot

@mbostock
Copy link
Member

Shouldn’t transitions be iterable?

@mbostock
Copy link
Member

#113

@mbostock
Copy link
Member

I recommend we revert 91990a1 in favor of #114. A number of inherited selection methods depend on transitions being iterable, such as transition.each and transition.nodes, and they’ll be broken unless transitions are iterable.

@Fil Fil closed this as completed in 91990a1 Aug 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants