From 32b79afbb3b19277d6303f4eece4f3ff20742c80 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 (cherry picked from commit 7e05d5c2e8084212584770fa52fe5701e2dd2166) --- .../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,