fix(redis): refresh sidebar db key counts after write commands

Redis write commands (SET/DEL/...) ran from the query editor or the
key-browser terminal did not update the dbN (count) labels in the left
tree until a manual refresh. Add refreshRedisDbKeyCounts(), which re-fetches
authoritative per-db counts via INFO keyspace and patches the labels in place
without rebuilding the tree (preserving expanded key nodes), then trigger it
fire-and-forget after any mutating command in both execution paths.
This commit is contained in:
haipengno1 authored and GitHub committed 2026-06-17 10:35:01 +08:00
1 parent b2617039fa
commit b575ec2729
3 files changed
+30

No files matched your search

@@ -447,6 +447,9 @@ async function runRedisCommand(command: string) {
// reflects keys added/removed/renamed by SET/DEL/RENAME/...
if (isRedisMutatingCommand(command)) {
connectionStore.invalidateCompletionCache(props.connectionId, String(executedDb));
// Refresh the sidebar db key counts (INFO keyspace) so `dbN (count)` stays accurate
// after the write. Fire-and-forget so the terminal stays responsive.
void connectionStore.refreshRedisDbKeyCounts(props.connectionId);
}
// Persist to history
persistRedisHistory(command, true, result.value);