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。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(updates): stop offering the release after Ignore this version
李子凡8c5a4f2eb6c3
diff --git a/apps/desktop/src/App.vue b/apps/desktop/src/App.vueindex 7a0ec57c5d..e37c74ff6c 100644--- a/apps/desktop/src/App.vue+++ b/apps/desktop/src/App.vue@@ -330,6 +330,7 @@ const {isPreparingUpdate,checkingUpdates,updateInfo,+ visibleUpdateInfo,updateCheckMessage,updateCheckFailed,showUpdateDialog,@@ -5901,7 +5902,7 @@ onUnmounted(() => {<UpdateDialogv-if="showUpdateDialog"v-model:open="showUpdateDialog"- :update-info="updateInfo"+ :update-info="visibleUpdateInfo":update-check-message="updateCheckMessage":checking-updates="checkingUpdates":update-check-failed="updateCheckFailed"diff --git a/apps/desktop/src/composables/__tests__/useAppUpdater.spec.ts b/apps/desktop/src/composables/__tests__/useAppUpdater.spec.tsindex 8759493ec3..bea37ce004 100644--- a/apps/desktop/src/composables/__tests__/useAppUpdater.spec.ts+++ b/apps/desktop/src/composables/__tests__/useAppUpdater.spec.ts@@ -2,7 +2,7 @@import { createApp, defineComponent, h, reactive, nextTick, type App } from "vue";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import i18n from "@/i18n";-import { isNewerRemoteVersion, resolveReleaseTagUrl, useAppUpdater } from "@/composables/useAppUpdater";+import { effectiveUpdateInfo, isNewerRemoteVersion, resolveReleaseTagUrl, useAppUpdater } from "@/composables/useAppUpdater";const mocks = vi.hoisted(() => ({checkForUpdates: vi.fn(),downloadUpdate: vi.fn(),@@ -558,3 +558,48 @@ describe("toolbar update entry visibility (#11041)", () => {await background;});});++describe("ignoring a version (#13626)", () => {+ it("stops the update dialog from offering the ignored release", async () => {+ const updater = mount();+ await updater.initialize();+ await flush();+ expect(updater.updateInfo.value?.update_available).toBe(true);++ await updater.ignoreCurrentVersion();+ await flush();++ expect(mocks.persist).toHaveBeenCalledWith({ ignoredUpdateVersion: "1.1.0" });+ expect(updater.hasUpdateAvailable.value).toBe(false);+ expect(updater.visibleUpdateInfo.value?.update_available).toBe(false);+ });++ it("keeps a newer release visible after an older one was ignored", async () => {+ settings.ignoredUpdateVersion = "1.0.5";+ mocks.checkForUpdates.mockResolvedValue({ ...info, latest_version: "1.1.0" });+ const updater = mount();+ await updater.initialize();+ await flush();++ expect(updater.hasUpdateAvailable.value).toBe(true);+ expect(updater.visibleUpdateInfo.value?.update_available).toBe(true);+ });++ it("discards an ignored cached package at startup and keeps the dialog quiet", async () => {+ settings.ignoredUpdateVersion = "1.1.0";+ mocks.getDownloadedUpdate.mockResolvedValue(cache);+ const updater = mount();+ await updater.initialize();+ await flush();++ expect(mocks.discardDownloadedUpdate).toHaveBeenCalledWith("cached");+ expect(updater.visibleUpdateInfo.value?.update_available).toBe(false);+ });++ it("keeps a prepared package visible even when its version is ignored", () => {+ expect(effectiveUpdateInfo(info, "1.1.0", true)).toBe(info);+ expect(effectiveUpdateInfo(info, "1.1.0", false)).toEqual({ ...info, update_available: false });+ expect(effectiveUpdateInfo(info, "1.0.5", false)).toBe(info);+ expect(effectiveUpdateInfo(null, "1.1.0", false)).toBeNull();+ });+});diff --git a/apps/desktop/src/composables/useAppUpdater.ts b/apps/desktop/src/composables/useAppUpdater.tsindex 1f8caf696e..83d7bf9636 100644--- a/apps/desktop/src/composables/useAppUpdater.ts+++ b/apps/desktop/src/composables/useAppUpdater.ts@@ -79,6 +79,19 @@ export function isUpdateIgnored(info: api.UpdateInfo | null, ignoredVersion: strreturn compareParsedUpdateVersions(parsedLatest, parsedIgnored) <= 0;}+/**+ * The update info as the UI should see it. An ignored version is hidden here+ * rather than in each consumer: the dialog renders from `updateInfo` directly+ * and only the toolbar badge consulted `isUpdateIgnored`, so "Ignore this+ * version" cleared the badge but left the dialog still offering the release+ * (#13626). A downloaded or prepared package is never hidden — the user+ * already has it and the install action must stay reachable.+ */+export function effectiveUpdateInfo(info: api.UpdateInfo | null, ignoredVersion: string | undefined, hasPreparedUpdate: boolean): api.UpdateInfo | null {+ if (!info || hasPreparedUpdate || !isUpdateIgnored(info, ignoredVersion)) return info;+ return { ...info, update_available: false };+}+export function isNewerRemoteVersion(latest: string, cached: string): boolean {const parsedLatest = parseUpdateVersion(latest);const parsedCached = parseUpdateVersion(cached);@@ -154,6 +167,8 @@ export function useAppUpdater(options: UseAppUpdaterOptions = {}) {// explicit "Check for updates" action in settings keeps working.const updateEntryVisible = computed(() => settingsStore.editorSettings.toolbarItems?.checkUpdates !== false);const hasUpdateAvailable = computed(() => (updateDownloaded.value || updateReady.value || updateInfo.value?.update_available === true) && !isUpdateIgnored(updateInfo.value, settingsStore.editorSettings.ignoredUpdateVersion));+ /** What the update dialog renders: an ignored release stops offering itself. */+ const visibleUpdateInfo = computed(() => effectiveUpdateInfo(updateInfo.value, settingsStore.editorSettings.ignoredUpdateVersion, updateDownloaded.value || updateReady.value));const latestReleaseUrl = "https://github.com/t8y2/dbx/releases/latest";let generation = 0;let activeDownload: Promise<void> | undefined;@@ -525,6 +540,7 @@ export function useAppUpdater(options: UseAppUpdaterOptions = {}) {phase,checkingUpdates,updateInfo,+ visibleUpdateInfo,updateCheckMessage,updateCheckFailed,showUpdateDialog,