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

Fix key unicity on PitComponents #87

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sylvain-a
Copy link

Hello guys,

thank you for this great component ! I use it in my project, that contains a lot of other REACT components. Unfortunately, I have warnings indicating that the key of the PitComponent is not unique. I quickly updated the value of the "key" attribute that is generating to make it more "unique"...
Does I missed something, or is that the good way to do it ?
Thanks,
Sylvain

const pos = algorithm.getPosition(n, min, max);
const pitStyle = orientation === 'vertical'
? { top: `${pos}%`, position: 'absolute' }
: { left: `${pos}%`, position: 'absolute' };

return (
<PitComponent key={n} style={pitStyle}>{n}</PitComponent>
<PitComponent key={`${n}_PC_${index}`} style={pitStyle}>{n}</PitComponent>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are the pit points not unique?

Regardless, if there's nothing unique about the item, just key={index} is sufficient - anything else is just a waste.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I took the wrong direction. My first idea was to add small CSS blocs on top of others to manage the height of the pit points (that leads to not unique pit points...)

So if I have to put only 1 pit point per value, how do you manage the height of the point ? When the component is rendered outside the lib, I don't have enough information to calculate its height...

Thank you,
Sylvain

Copy link
Collaborator

@ljharb ljharb May 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@goatslacker can probably help here

This comment was marked as off-topic.

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants