From ac6d68d17d94ff43e8e5dc0782ea1f8a091a8253 Mon Sep 17 00:00:00 2001 From: Lykin <137850705+tiny-craft@users.noreply.github.com> Date: Thu, 4 Jan 2024 00:44:27 +0800 Subject: [PATCH] fix: clean selected keys after deleted --- frontend/src/components/sidebar/BrowserPane.vue | 12 +++++++----- frontend/src/stores/browser.js | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/sidebar/BrowserPane.vue b/frontend/src/components/sidebar/BrowserPane.vue index b048012..655df09 100644 --- a/frontend/src/components/sidebar/BrowserPane.vue +++ b/frontend/src/components/sidebar/BrowserPane.vue @@ -127,11 +127,13 @@ const onAddKey = () => { const selectedKey = get(browserTreeRef.value?.getSelectedKey(), 0) if (selectedKey != null) { const node = browserStore.getNode(selectedKey) - const { type = ConnectionType.RedisValue, redisKey } = node - if (type === ConnectionType.RedisKey) { - // has prefix - dialogStore.openNewKeyDialog(redisKey, props.server, props.db) - return + if (node != null) { + const { type = ConnectionType.RedisValue, redisKey } = node + if (type === ConnectionType.RedisKey) { + // has prefix + dialogStore.openNewKeyDialog(redisKey, props.server, props.db) + return + } } } dialogStore.openNewKeyDialog('', props.server, props.db) diff --git a/frontend/src/stores/browser.js b/frontend/src/stores/browser.js index baccd96..8ce7c63 100644 --- a/frontend/src/stores/browser.js +++ b/frontend/src/stores/browser.js @@ -1526,6 +1526,8 @@ const useBrowserStore = defineStore('browser', { // set tab content empty const tab = useTabStore() tab.emptyTab(server) + tab.setSelectedKeys(server) + tab.setCheckedKeys(server) return true } finally { }