Skip to content

Commit

Permalink
fix: incorrect keys count display of database after delete the only r…
Browse files Browse the repository at this point in the history
…emaining key. tiny-craft#47
  • Loading branch information
tiny-craft committed Oct 11, 2023
1 parent 7673498 commit 44f8581
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions frontend/src/stores/connections.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,11 +532,10 @@ const useConnectionStore = defineStore('connections', {
selDB.opened = true
if (isEmpty(keys)) {
selDB.children = []
return
} else {
// append db node to current connection's children
this._addKeyNodes(connName, db, keys)
}

// append db node to current connection's children
this._addKeyNodes(connName, db, keys)
this._tidyNode(connName, db)
},

Expand Down Expand Up @@ -874,7 +873,7 @@ const useConnectionStore = defineStore('connections', {

/**
* sort all node item's children and calculate keys count
* @param node
* @param {DatabaseItem} node
* @param {boolean} skipSort skip sorting children
* @returns {boolean} return whether key count changed
* @private
Expand All @@ -891,7 +890,12 @@ const useConnectionStore = defineStore('connections', {
count += elem.keys
}
} else {
count += 1
if (node.type === ConnectionType.RedisValue) {
count += 1
} else {
// no children in db node or layer node, set count to 0
count = 0
}
}
if (node.keys !== count) {
node.keys = count
Expand Down

0 comments on commit 44f8581

Please sign in to comment.