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): redis命令控制台上下文隔离

dalewc8385c16f236
diff --git a/apps/desktop/src/components/redis/RedisKeyBrowser.vue b/apps/desktop/src/components/redis/RedisKeyBrowser.vue
index dcfdc39776..f7995f7032 100644
--- a/apps/desktop/src/components/redis/RedisKeyBrowser.vue
+++ b/apps/desktop/src/components/redis/RedisKeyBrowser.vue
@@ -816,38 +816,13 @@ function resumeRedisBrowserBackgroundWork() {
registerRedisDbFlushedListener();
}
-async function loadPersistedRedisHistory() {
- try {
- const entries = await api.loadRedisHistory(200, 0);
- if (entries.length === 0) return;
- // Merge persisted entries into in-memory commandHistory (newest first, reversed for display order)
- const persisted: RedisCommandHistoryEntry[] = entries.reverse().map((entry) => ({
- id: ++commandHistoryId,
- prompt: `db${entry.database}>`,
- command: entry.sql,
- output: entry.details_json ? formatRedisCommandResult(JSON.parse(entry.details_json)) : entry.error || "",
- error: !entry.success,
- }));
- commandHistory.value = [...persisted, ...commandHistory.value];
- scrollCommandTerminalToEnd();
- } catch {
- // Silently ignore load errors — history is best-effort
- }
-}
-
-async function clearPersistedRedisHistory() {
- try {
- await api.clearRedisHistory();
- toast(t("redis.historyCleared"));
- } catch {
- // Silently ignore
- }
+async function clearInMemoryHistory() {
+ commandHistory.value = [];
}
onMounted(() => {
resumeRedisBrowserBackgroundWork();
void loadKeys();
- void loadPersistedRedisHistory();
});
onActivated(resumeRedisBrowserBackgroundWork);
@@ -976,7 +951,7 @@ defineExpose({ focusSearch });
{{ t("redis.pubsub") }}
</TabsTrigger>
</TabsList>
- <Button v-if="activeSidePanel === 'command'" variant="ghost" size="icon" class="h-6 w-6" :title="t('redis.clearHistory')" @click="clearPersistedRedisHistory">
+ <Button v-if="activeSidePanel === 'command'" variant="ghost" size="icon" class="h-6 w-6" :title="t('redis.clearHistory')" @click="clearInMemoryHistory">
<History class="size-3.5" />
</Button>
</div>