From fae644b88877b7d28cf3cbc656b18098e055089b Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Sun, 21 Jun 2026 18:55:01 +0800 Subject: [PATCH] fix(redis): exclude empty commands from history navigation - Empty commands show temporary error hint (1s) but not added to history - Arrow key navigation skips empty command entries - Add appendCommandOutput helper for transient feedback --- .../src/components/redis/RedisKeyBrowser.vue | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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) { scrollCommandTerminalToEnd(); } +function appendCommandOutput(entry: Omit) { + // 显示输出但不记入历史(用于错误提示、空命令提示等) + 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"),