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

Warning: Failed prop type: Invalid prop events[0].eventKey supplied to VictoryPie #1923

Closed
AScholan opened this issue Aug 2, 2021 · 2 comments
Labels
Note: Good first issue 🤩 Good issue for new contributors Status: Help Wanted 🔨 Extra attention is needed

Comments

@AScholan
Copy link

AScholan commented Aug 2, 2021

Bugs and Questions

Checklist

  • [ x] This is not a victory-native specific issue. (Issues that only appear in victory-native should be opened here)

  • [ x] I have read through the FAQ and Guides before asking a question

  • [x ] I am using the latest version of Victory

  • [ x] I've searched open issues to make sure I'm not opening a duplicate issue

The Problem

I am seeing the following warning when I am setting the eventKey value for events relating to VictoryPie:

Warning: Failed prop type: Invalid prop events[0].eventKey supplied to VictoryPie.
at addEvents (https://x6s4l.csb.app/node_modules/victory-core/es/victory-util/add-events.js:109:7)
at CircularSegmentInput (https://x6s4l.csb.app/src/circular-segment-input.js:63:3)
at StatisticsPage (https://x6s4l.csb.app/src/statistics-page.js:27:41)
at div
at App

What I am doing

I have created a circular input control with a number of segments.

  • Each segment can either be selectable or not.
  • Selectable segments can either be normal, or show an issue.
  • One selectable segment can be active.

I have attached the following events:

  • onMouseOver, onMouseOut: These change the hover color for the segment when the mouse is over the segment. They also change the style of the cursor in the parent object so that selectable entries have the pointer cursor.
  • onClick: Used to change the active element.

Because I couldn't find appropriate props information to handle the cursor change in the parent, I used the eventKey property of the events object to attach the event only to selectable segments. This works but gives the above warning. I have specified the eventKey property correctly, I believe, as a list of indexes for the event to be applied.

Reproduction

Please see the following sandbox: https://codesandbox.io/s/victory-pie-eventkey-warning-reproduction-x6s4l

The code sandbox runs correctly with correct behaviour for the controls but shows the warning in the console.

@becca-bailey
Copy link
Contributor

becca-bailey commented Aug 4, 2021

Sounds like a prop types warning - this should not prevent the code from running, but should be a quick fix to update the prop types here.

@becca-bailey becca-bailey added Note: Good first issue 🤩 Good issue for new contributors Status: Help Wanted 🔨 Extra attention is needed labels Aug 4, 2021
@AScholan
Copy link
Author

AScholan commented Aug 4, 2021

BTW this is the first time I'm using Victory and chose it over other React charting libraries (ReCharts was other final contender) because of the much better standard of documentation for Victory and the more flexible event system.
Well done to the team for this professional library.

tgalfin added a commit to tgalfin/victory that referenced this issue Sep 17, 2021
Add array to PropTypes for events.eventKey in victory-pie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Note: Good first issue 🤩 Good issue for new contributors Status: Help Wanted 🔨 Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants