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

Event listeners arguments should be (event, d) but in some projects are (d, index) #24

Open
caesarsol opened this issue Mar 24, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@caesarsol
Copy link
Contributor

we had some notifications that in some cases the defined events listeners were called with (d, i) as parameters, and no events.

we are relying on d3-selection (added as a peerDependency) for the event listeners, and after checking I discovered that the problem was caused by which version of d3-selection is used in the project (which is sometimes not strictly linked to which version of d3 is used, unfortunately):

  • in d3-selection v1.4.1 the rule was:

    When a specified event is dispatched on a selected element, the specified listener will be evaluated for the element, being passed the current datum (d), the current index (i), and the current group (nodes)

  • in d3-selection v2.0.0 (and hence v3.0.0) that changed:

    When a specified event is dispatched on a selected element, the specified listener will be evaluated for the element, being passed the current event (event) and the current datum (d)

we will need to:

  1. clear this out in the README
  2. find a reliable solution, maybe backward compatible. possibly add d3-selection as a hard dependency?
@caesarsol caesarsol added the bug Something isn't working label Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant