From 2e5fc777fa2ca9503b36ed400c56f374598c353e Mon Sep 17 00:00:00 2001 From: Ramilito Date: Wed, 30 Oct 2024 02:01:19 +0100 Subject: [PATCH] fix: remove item from selection if it's deleted (#499) --- lua/kubectl/actions/informer.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/kubectl/actions/informer.lua b/lua/kubectl/actions/informer.lua index d89ab4c0..2ad34fb7 100644 --- a/lua/kubectl/actions/informer.lua +++ b/lua/kubectl/actions/informer.lua @@ -37,6 +37,11 @@ local function process_event(builder, event_string) elseif event.type == "DELETED" then for index, item in ipairs(is_table and target.rows or target) do if (is_table and item.object.metadata.name or item.metadata.name) == event_name then + for selection_index, selection in ipairs(state.selections) do + if selection.name == item.metadata.name then + table.remove(state.selections, selection_index) + end + end table.remove(is_table and target.rows or target, index) break end