Commit 94f87c72 by Dominik Prokop Committed by GitHub

Fix react missing key warnings (#23498)

parent 32555fc7
...@@ -182,9 +182,9 @@ export const DefaultFieldConfigEditor: React.FC<Props> = ({ data, onChange, conf ...@@ -182,9 +182,9 @@ export const DefaultFieldConfigEditor: React.FC<Props> = ({ data, onChange, conf
return ( return (
<> <>
{Object.keys(groupedConfigs).map(k => { {Object.keys(groupedConfigs).map((k, i) => {
return ( return (
<OptionsGroup title={k}> <OptionsGroup title={k} key={`${k}/${i}`}>
<> <>
{groupedConfigs[k].map(c => { {groupedConfigs[k].map(c => {
return renderEditor(c); return renderEditor(c);
......
...@@ -25,9 +25,9 @@ export const PanelOptionsEditor: React.FC<PanelOptionsEditorProps<any>> = ({ plu ...@@ -25,9 +25,9 @@ export const PanelOptionsEditor: React.FC<PanelOptionsEditorProps<any>> = ({ plu
return ( return (
<> <>
{Object.keys(optionEditors).map(c => { {Object.keys(optionEditors).map((c, i) => {
const optionsToShow = optionEditors[c] const optionsToShow = optionEditors[c]
.map((e, i) => { .map((e, j) => {
if (e.showIf && !e.showIf(options)) { if (e.showIf && !e.showIf(options)) {
return null; return null;
} }
...@@ -38,7 +38,7 @@ export const PanelOptionsEditor: React.FC<PanelOptionsEditorProps<any>> = ({ plu ...@@ -38,7 +38,7 @@ export const PanelOptionsEditor: React.FC<PanelOptionsEditorProps<any>> = ({ plu
</Forms.Label> </Forms.Label>
); );
return ( return (
<Forms.Field label={label} key={`${e.id}/i`}> <Forms.Field label={label} key={`${e.id}/${j}`}>
<e.editor <e.editor
value={lodashGet(options, e.path)} value={lodashGet(options, e.path)}
onChange={value => onOptionChange(e.path, value)} onChange={value => onOptionChange(e.path, value)}
...@@ -50,7 +50,7 @@ export const PanelOptionsEditor: React.FC<PanelOptionsEditorProps<any>> = ({ plu ...@@ -50,7 +50,7 @@ export const PanelOptionsEditor: React.FC<PanelOptionsEditorProps<any>> = ({ plu
.filter(e => e !== null); .filter(e => e !== null);
return optionsToShow.length > 0 ? ( return optionsToShow.length > 0 ? (
<OptionsGroup title={c} defaultToClosed> <OptionsGroup title={c} defaultToClosed key={`${c}/${i}`}>
<div>{optionsToShow}</div> <div>{optionsToShow}</div>
</OptionsGroup> </OptionsGroup>
) : null; ) : null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment