Skip to content

Commit

Permalink
ColorPresets: fix duplicate keys (ant-design#44370)
Browse files Browse the repository at this point in the history
* ColorPresets: fix duplicate keys

Signed-off-by: xr0master <xr0master@gmail.com>

* Update components/color-picker/components/ColorPresets.tsx

add lint disable

Signed-off-by: xr0master <xr0master@gmail.com>

---------

Signed-off-by: xr0master <xr0master@gmail.com>
  • Loading branch information
xr0master authored Aug 24, 2023
1 parent e91f927 commit eaa8635
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions components/color-picker/components/ColorPresets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ const ColorPresets: FC<ColorPresetsProps> = ({ prefixCls, presets, value: color,
children: (
<div className={`${colorPresetsPrefixCls}-items`}>
{Array.isArray(preset?.colors) && preset.colors?.length > 0 ? (
preset.colors.map((presetColor: Color) => (
preset.colors.map((presetColor: Color, index: number) => (
<ColorBlock
key={`preset-${presetColor.toHexString()}`}
// eslint-disable-next-line react/no-array-index-key
key={`preset-${index}-${presetColor.toHexString()}`}
color={generateColor(presetColor).toRgbString()}
prefixCls={prefixCls}
className={classNames(`${colorPresetsPrefixCls}-color`, {
Expand Down

0 comments on commit eaa8635

Please sign in to comment.