From 5fd004b86ef6e7239b071c60d1749b2586081e99 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 11 Jul 2023 18:06:17 +0200 Subject: [PATCH] Remove view on deletion --- .../backend/TableNavigator/popovers/EditViewPopover.svelte | 3 +-- packages/builder/src/stores/backend/views.js | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/builder/src/components/backend/TableNavigator/popovers/EditViewPopover.svelte b/packages/builder/src/components/backend/TableNavigator/popovers/EditViewPopover.svelte index b637f46f5e..99f19935a1 100644 --- a/packages/builder/src/components/backend/TableNavigator/popovers/EditViewPopover.svelte +++ b/packages/builder/src/components/backend/TableNavigator/popovers/EditViewPopover.svelte @@ -35,9 +35,8 @@ try { const isSelected = decodeURIComponent($params.viewName) === $views.selectedViewName - const name = view.name const id = view.tableId - await views.delete(name) + await views.delete(view) notifications.success("View deleted") if (isSelected) { $goto(`./table/${id}`) diff --git a/packages/builder/src/stores/backend/views.js b/packages/builder/src/stores/backend/views.js index 2f396096c8..b01f31c4bd 100644 --- a/packages/builder/src/stores/backend/views.js +++ b/packages/builder/src/stores/backend/views.js @@ -26,14 +26,12 @@ export function createViewsStore() { } const deleteView = async view => { - await API.deleteView(view) + await API.deleteView(view.name) // Update tables tables.update(state => { const table = state.list.find(table => table._id === view.tableId) - if (table) { - delete table.views[view.name] - } + delete table.views[view.name] return { ...state } }) }