Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(redis): exclude empty commands from history navigation

t8y2fae644b88877
diff --git a/apps/desktop/src/components/redis/RedisKeyBrowser.vue b/apps/desktop/src/components/redis/RedisKeyBrowser.vue
index a1ed3a09eb..184eb342a7 100644
--- a/apps/desktop/src/components/redis/RedisKeyBrowser.vue
+++ b/apps/desktop/src/components/redis/RedisKeyBrowser.vue
@@ -428,6 +428,17 @@ function appendCommandHistory(entry: Omit<RedisCommandHistoryEntry, "id">) {
scrollCommandTerminalToEnd();
}
+function appendCommandOutput(entry: Omit<RedisCommandHistoryEntry, "id">) {
+ // 显示输出但不记入历史(用于错误提示、空命令提示等)
+ const tempEntry = { id: ++commandHistoryId, ...entry };
+ commandHistory.value = [...commandHistory.value, tempEntry];
+ scrollCommandTerminalToEnd();
+ // 1秒后自动移除提示
+ setTimeout(() => {
+ commandHistory.value = commandHistory.value.filter((e) => e.id !== tempEntry.id);
+ }, 1000);
+}
+
async function runRedisCommand(command: string) {
const prompt = commandPrompt.value;
commandRunning.value = true;
@@ -682,7 +693,8 @@ async function createRedisKey() {
async function executeCommand() {
const command = commandText.value.trim();
if (!command) {
- appendCommandHistory({
+ // 空命令显示提示但不记入历史
+ appendCommandOutput({
prompt: commandPrompt.value,
command: "",
output: t("redis.commandEmpty"),