-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Recently added d3-strict
check balks on parcoords
brush interaction with Dev Console open
#2244
Comments
... just noticed that due to this validation, |
Thanks for the deep dive @monfera - the reason we made this rule was to ensure you could render a chart into an unattached We could drop |
@alexcjohnson I took another look at this to see how your suggestion could work. As
On the short term item 4 seems the least obtrusive to me but the above enumeration is shared to prime your creative thoughts, there may well be a better idea than these. |
Just checking this report by @alexcjohnson:
The
test_dashboard
seems to work forparcoords
but indeed it shows the error in the console if Dev Tools are open.
It's good to avoid
.style('something')
or.attr('something')
getters in favor of one-directional data flow. If we can read something this way, probably we put that info there to begin with, so it should be in the model / viewModel. I was curious how it got in there.Turns out,
D3
itself is doing this in thed3.svg.brush
component which is used for the axis brush:This one seems to have a good motive, and also safe because the
eventTarget
must exist in the DOM in order to capture an event, and the event callback, being synchronous, can't be preceded by the target removal, and I'm wondering how we could exempt it.To clarify, what's meant by unattached elements, simply, not being in the document tree? For reasons of possible leak avoidance and API compactness (I think)
D3
doesn't separatecreateElement
and attachment (appendChild
orinsertBefore
) so an.append()
will do both. SoD3
isn't optimized for creation of entire DOM fragments for subsequent attachment or repeated attachment/removal (would be neat as it can reduce jank via less gc). Upon.remove()
the node gets removed from the DOM but can't immediately get garbage collected because theD3
selection inv3
andv4
hangs onto it via a strong reference, so we can still query the detached node (v4
):https://codepen.io/anon/pen/ppVvVB
If the node got
.remove
d and the corresponding selection in the lexical scope is gone (ie. GC happened and we might be in some subsequent function), then we can no longer reference it via that selection and have to perform a new selection, and with the node detached, the node won't be in it.So it'd be good to know what case resulted in the creation of this rule; not knowing that, these might be some options, each has challenges so looking for input:
D3
(seems hard, unwieldy or error prone)D3
to not need this, make a PR for it and hope it gets merged (ifs)parcoords
(but it's not needed in prod code)test_dashboard
it's a problem only if Dev Tools is open and it's set to stop on errorsI tested some other plots with
D3
based interactions (sankey
,table
) but they didn't have this issue. Any chart however might in theory have non-strict-d3
calls on interactions as it's a runtime check.The text was updated successfully, but these errors were encountered: