-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Addon-controls: Fix duplicate color swatch id's in Color control #14925
Addon-controls: Fix duplicate color swatch id's in Color control #14925
Conversation
Nx Cloud ReportCI ran the following commands for commit c41c801. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch
Sent with 💌 from NxCloud. |
Nx Cloud ReportWe didn't find any information for the current pull request with the commit c41c801. Check the Getting started section to configure the app. Sent with 💌 from NxCloud. |
<WithTooltip | ||
key={preset.value} | ||
// eslint-disable-next-line react/no-array-index-key | ||
key={`${preset.value}-${index}`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there is a way to get unique keys without using the index.
type ParsedColor = {
valid: boolean;
value: string;
keyword: string;
colorSpace: ColorSpace;
[ColorSpace.RGB]: string;
[ColorSpace.HSL]: string;
[ColorSpace.HEX]: string;
};
Is there a better to solve this? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fine. The "optimized" way would be to only de-dupe when there are actual duplicates, so a,b,c,b
might become a,b1,c,b2
, but I don't think it's worth the effort
<WithTooltip | ||
key={preset.value} | ||
// eslint-disable-next-line react/no-array-index-key | ||
key={`${preset.value}-${index}`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fine. The "optimized" way would be to only de-dupe when there are actual duplicates, so a,b,c,b
might become a,b1,c,b2
, but I don't think it's worth the effort
Issue: #14793
What I did
{preset.value}-${index}
for loopedSwatches
to avoid duplicate keysHow to test
Before change
Kapture.2021-05-14.at.12.09.17.mp4
After change
Kapture.2021-05-14.at.12.12.08.mp4