From cb428747e23a5e6a4dfa09ca93db18edbcc6d15d Mon Sep 17 00:00:00 2001 From: Lykin <137850705+tiny-craft@users.noreply.github.com> Date: Sat, 28 Sep 2024 11:55:38 +0800 Subject: [PATCH] fix: key deletion operation was incomplete (#348) --- frontend/src/objects/redisServerState.js | 3 +++ frontend/src/stores/browser.js | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/frontend/src/objects/redisServerState.js b/frontend/src/objects/redisServerState.js index 54f682c..7713923 100644 --- a/frontend/src/objects/redisServerState.js +++ b/frontend/src/objects/redisServerState.js @@ -296,6 +296,9 @@ export class RedisServerState { removeKeyNode(key, isLayer) { if (isLayer === true) { this.deleteChildrenKeyNodes(key) + } else { + const nodeKey = `${ConnectionType.RedisValue}/${key}` + this.nodeMap.delete(nodeKey) } const dbRoot = this.getRoot() diff --git a/frontend/src/stores/browser.js b/frontend/src/stores/browser.js index d43a93b..a6575bc 100644 --- a/frontend/src/stores/browser.js +++ b/frontend/src/stores/browser.js @@ -708,17 +708,19 @@ const useBrowserStore = defineStore('browser', { } let match = prefix const separator = this.getSeparator(server) - if (!endsWith(match, separator)) { - match += separator + '*' - } else { - match += '*' + if (!isEmpty(match)) { + if (!endsWith(match, separator)) { + match += separator + '*' + } else { + match += '*' + } } // FIXME: ignore original match pattern due to redis not support combination matching const { match: originMatch, type: keyType, exact } = this.getKeyFilter(server) const { keys, maxKeys, success } = await this._loadKeys({ server, db, - match: originMatch, + match: match || originMatch, exact: false, matchType: keyType, all: true,