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 { }