fix: new key to a non-current database incorrectly refresh the tree view (#259)
This commit is contained in:
parent
f536b0f23b
commit
a2b0fc183f
|
@ -154,7 +154,11 @@ const onAdd = async () => {
|
||||||
value = defaultValue[type]
|
value = defaultValue[type]
|
||||||
}
|
}
|
||||||
// await browserStore.reloadKey({server, db, key: trim(key)})
|
// await browserStore.reloadKey({server, db, key: trim(key)})
|
||||||
const { success, msg, nodeKey } = await browserStore.setKey({
|
const {
|
||||||
|
success,
|
||||||
|
msg,
|
||||||
|
nodeKey = '',
|
||||||
|
} = await browserStore.setKey({
|
||||||
server,
|
server,
|
||||||
db,
|
db,
|
||||||
key: trim(key),
|
key: trim(key),
|
||||||
|
@ -165,8 +169,11 @@ const onAdd = async () => {
|
||||||
if (success) {
|
if (success) {
|
||||||
// select current key
|
// select current key
|
||||||
await nextTick()
|
await nextTick()
|
||||||
tabStore.setSelectedKeys(server, nodeKey)
|
const selectedDB = browserStore.getSelectedDB(server)
|
||||||
browserStore.reloadKey({ server, db, key })
|
if (selectedDB === db) {
|
||||||
|
tabStore.setSelectedKeys(server, nodeKey)
|
||||||
|
browserStore.reloadKey({ server, db, key })
|
||||||
|
}
|
||||||
} else if (!isEmpty(msg)) {
|
} else if (!isEmpty(msg)) {
|
||||||
$message.error(msg)
|
$message.error(msg)
|
||||||
}
|
}
|
||||||
|
|
|
@ -832,7 +832,7 @@ const useBrowserStore = defineStore('browser', {
|
||||||
if (success) {
|
if (success) {
|
||||||
/** @type RedisServerState **/
|
/** @type RedisServerState **/
|
||||||
const serverInst = this.servers[server]
|
const serverInst = this.servers[server]
|
||||||
if (serverInst != null) {
|
if (serverInst != null && serverInst.db === db) {
|
||||||
// const { value } = data
|
// const { value } = data
|
||||||
// update tree view data
|
// update tree view data
|
||||||
const { newKey = 0 } = serverInst.addKeyNodes([key], true)
|
const { newKey = 0 } = serverInst.addKeyNodes([key], true)
|
||||||
|
@ -840,11 +840,12 @@ const useBrowserStore = defineStore('browser', {
|
||||||
serverInst.tidyNode(key)
|
serverInst.tidyNode(key)
|
||||||
serverInst.updateDBKeyCount(db, newKey)
|
serverInst.updateDBKeyCount(db, newKey)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
const { value: updatedValue } = data
|
const { value: updatedValue } = data
|
||||||
if (updatedValue != null) {
|
if (updatedValue != null) {
|
||||||
const tab = useTabStore()
|
const tab = useTabStore()
|
||||||
tab.updateValue({ server, db, key, value: updatedValue })
|
tab.updateValue({ server, db, key, value: updatedValue })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// this.loadKeySummary({ server, db, key })
|
// this.loadKeySummary({ server, db, key })
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue