From 124d90bb7c6f2fb850397cfc669e08a736c4715a Mon Sep 17 00:00:00 2001 From: Yan Savitski Date: Sat, 24 Feb 2024 16:42:42 +0100 Subject: [PATCH] [AI Playground] Fix react array withouth key error --- .../view_query/view_query_action.tsx | 107 +++++++++--------- 1 file changed, 52 insertions(+), 55 deletions(-) diff --git a/packages/kbn-ai-playground/components/view_query/view_query_action.tsx b/packages/kbn-ai-playground/components/view_query/view_query_action.tsx index e9755ef63280a..beca5323aed26 100644 --- a/packages/kbn-ai-playground/components/view_query/view_query_action.tsx +++ b/packages/kbn-ai-playground/components/view_query/view_query_action.tsx @@ -107,61 +107,58 @@ export const ViewQueryAction: React.FC = () => {
Selected Fields
- {Object.keys(fields).map((index: string) => { - const group = fields[index]; - return ( - - - -
{index}
- - } - > - - ({ - field: typeof field === 'string' ? field : field.field, - }))} - columns={[ - { - field: 'field', - name: 'Field', - truncateText: false, - render: (field) => field, - }, - { - actions: [ - { - name: 'toggle', - description: 'Toggle field', - isPrimary: true, - render: ({ field }: { field: string }) => ( - toggleQueryField(index, field)} - compressed - /> - ), - }, - ], - }, - ]} - hasActions - /> -
-
-
- ); - })} + {Object.entries(fields).map(([index, group]) => ( + + + +
{index}
+ + } + > + + ({ + field: typeof field === 'string' ? field : field.field, + }))} + columns={[ + { + field: 'field', + name: 'Field', + truncateText: false, + render: (field: string) => field, + }, + { + actions: [ + { + name: 'toggle', + description: 'Toggle field', + isPrimary: true, + render: ({ field }: { field: string }) => ( + toggleQueryField(index, field)} + compressed + /> + ), + }, + ], + }, + ]} + hasActions + /> +
+
+
+ ))}