I have a Heisenbug. With the following code:
const node = graphBox
.selectAll("g.node")
.data(nodes, d => d.title)
.join("g")
.attr("class", "node");
node.on("dblclick", d => {
const refs = d3.select(this)
.selectAll("text.ref")
.data(d.refs)
.join("text");
...
});
this
is a g
element. d.refs
is populated with an array.
When this code runs through on its own, refs
comes up empty. It looks like this:
refs: Pt
_groups: []
_parents: []
When I stop a debugger just before the refs assignment, and run the identical code in console, it comes up with this:
refs: Pt
_groups: [Array(1)]
_parents: [g]
I'm really stumped. What could cause this?