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): sync detail pane size badge on auto refresh

Melody Rucha196a68d38ab
diff --git a/apps/desktop/src/components/redis/RedisValueViewer.expiry.spec.ts b/apps/desktop/src/components/redis/RedisValueViewer.expiry.spec.ts
index 8db77633c9..81ea1bf070 100644
--- a/apps/desktop/src/components/redis/RedisValueViewer.expiry.spec.ts
+++ b/apps/desktop/src/components/redis/RedisValueViewer.expiry.spec.ts
@@ -314,7 +314,7 @@ describe("RedisValueViewer expiry saving", () => {
expect(document.querySelector<HTMLElement>("[data-slot='badge'][aria-label='redis.expiry']")?.textContent).toContain("50s");
});
- it("polls the full value at the configured interval without refreshing the parent key tree", async () => {
+ it("polls the full value at the configured interval and reports it to the parent", async () => {
vi.useFakeTimers();
localStorage.setItem("dbx-redis-auto-refresh-enabled-v2", "true");
localStorage.setItem("dbx-redis-auto-refresh-interval-seconds-v2", "5");
@@ -328,7 +328,10 @@ describe("RedisValueViewer expiry saving", () => {
expect(mocks.redisGetValue).toHaveBeenCalledTimes(2);
expect(mocks.redisGetTtl).not.toHaveBeenCalled();
- expect(loaded).toHaveBeenCalledOnce();
+ // The parent holds the key record the detail header's size badge reads, so
+ // a poll has to report the refreshed value for the badge to follow it.
+ expect(loaded).toHaveBeenCalledTimes(2);
+ expect(loaded.mock.calls[1][0]).toMatchObject({ ttl: 45 });
expect(document.querySelector<HTMLTextAreaElement>("textarea")?.value).toBe("refreshed");
expect(document.querySelector<HTMLElement>("[data-slot='badge'][aria-label='redis.expiry']")?.textContent).toContain("45s");
});
diff --git a/apps/desktop/src/components/redis/RedisValueViewer.vue b/apps/desktop/src/components/redis/RedisValueViewer.vue
index 8ac915d29b..abfd71b954 100644
--- a/apps/desktop/src/components/redis/RedisValueViewer.vue
+++ b/apps/desktop/src/components/redis/RedisValueViewer.vue
@@ -334,10 +334,13 @@ async function refreshAutoValue() {
const requestId = ++autoRefreshRequestId;
refreshingValue.value = true;
try {
+ // The parent owns the key record this panel's header reads its size badge
+ // from, so a poll that skipped notifying it left the badge frozen at the
+ // value the key had when it was opened. Notifying is cheap: the parent
+ // refreshes that one record's metadata in place.
const applied = await load({
background: true,
preserveDraft: true,
- notifyParent: false,
shouldApply: () => requestId === autoRefreshRequestId && !hasUnsavedRedisDraft.value && !shouldPauseAutoValueRefresh() && autoRefreshEnabled.value && canRunAutoRefresh(),
});
if (requestId !== autoRefreshRequestId || !applied || !data.value) return;