fix: clean selected keys after deleted

This commit is contained in:
Lykin 2024-01-04 00:44:27 +08:00
parent 23087a5374
commit ac6d68d17d
2 changed files with 9 additions and 5 deletions

View File

@ -127,11 +127,13 @@ const onAddKey = () => {
const selectedKey = get(browserTreeRef.value?.getSelectedKey(), 0) const selectedKey = get(browserTreeRef.value?.getSelectedKey(), 0)
if (selectedKey != null) { if (selectedKey != null) {
const node = browserStore.getNode(selectedKey) const node = browserStore.getNode(selectedKey)
const { type = ConnectionType.RedisValue, redisKey } = node if (node != null) {
if (type === ConnectionType.RedisKey) { const { type = ConnectionType.RedisValue, redisKey } = node
// has prefix if (type === ConnectionType.RedisKey) {
dialogStore.openNewKeyDialog(redisKey, props.server, props.db) // has prefix
return dialogStore.openNewKeyDialog(redisKey, props.server, props.db)
return
}
} }
} }
dialogStore.openNewKeyDialog('', props.server, props.db) dialogStore.openNewKeyDialog('', props.server, props.db)

View File

@ -1526,6 +1526,8 @@ const useBrowserStore = defineStore('browser', {
// set tab content empty // set tab content empty
const tab = useTabStore() const tab = useTabStore()
tab.emptyTab(server) tab.emptyTab(server)
tab.setSelectedKeys(server)
tab.setCheckedKeys(server)
return true return true
} finally { } finally {
} }