From 28fe41962f55f516ce51514ba9fa57cff8ac54a4 Mon Sep 17 00:00:00 2001 From: Ulas Kalayci Date: Sun, 26 Apr 2026 18:30:27 +0200 Subject: [PATCH] fix(shopping): fix undo callback for list deletion Replace local state mutation after list deletion with loadLists() so the tab bar stays in sync with the server. Also add a renderTabs() call in the error path so the UI recovers correctly on API failure. Co-Authored-By: Claude Sonnet 4.6 --- public/pages/shopping.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/pages/shopping.js b/public/pages/shopping.js index 5ca1b7d..5f05255 100644 --- a/public/pages/shopping.js +++ b/public/pages/shopping.js @@ -786,13 +786,14 @@ function wireListContentEvents(container) { let undone = false; window.oikos.showToast(t('shopping.deletedListToast'), 'default', 5000, () => { undone = true; + // Liste wurde nie optimistisch ausgeblendet → kein visuelles Restore nötig }); setTimeout(async () => { if (undone) return; try { await api.delete(`/shopping/${deletedListId}`); - state.lists = state.lists.filter((l) => l.id !== deletedListId); + await loadLists(); state.activeListId = state.lists[0]?.id ?? null; if (state.activeListId) { await switchList(state.activeListId, container); @@ -804,6 +805,8 @@ function wireListContentEvents(container) { } } catch (err) { window.oikos.showToast(err.message ?? t('common.unknownError'), 'danger'); + await loadLists(); + renderTabs(container); } }, 5000); }