From 7e05d5c2e8084212584770fa52fe5701e2dd2166 Mon Sep 17 00:00:00 2001 From: Dima Arnautov Date: Wed, 30 Oct 2024 16:34:29 +0100 Subject: [PATCH] [ML] Fix the Trained Models table expanded row refresh (#198149) ## Summary Fixes a regression introduced in https://github.com/elastic/kibana/pull/194614/, where the content of expanded rows in the Trained Model table stopped being updated on refresh. Co-authored-by: Elastic Machine --- .../application/model_management/models_list.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/x-pack/plugins/ml/public/application/model_management/models_list.tsx b/x-pack/plugins/ml/public/application/model_management/models_list.tsx index f218030c65ad3..9dbdf6069aff6 100644 --- a/x-pack/plugins/ml/public/application/model_management/models_list.tsx +++ b/x-pack/plugins/ml/public/application/model_management/models_list.tsx @@ -316,6 +316,16 @@ export const ModelsList: FC = ({ }; }); }); + + setItemIdToExpandedRowMap((prev) => { + // Refresh expanded rows + return Object.fromEntries( + Object.keys(prev).map((modelId) => { + const item = resultItems.find((i) => i.model_id === modelId); + return item ? [modelId, ] : []; + }) + ); + }); } catch (error) { displayErrorToast( error,