fix(updates): keep toolbar update entry visible when updates exist

This commit is contained in:
zipg
2026-09-22 15:43:12 +08:00
committed by GitHub
parent 6b06522ced
commit e1a512fd59
2 changed files with 12 additions and 2 deletions
@@ -78,6 +78,7 @@ const { t } = useI18n();
const { toast } = useToast();
const settingsStore = useSettingsStore();
const toolbarItems = computed(() => settingsStore.editorSettings.toolbarItems);
const showToolbarUpdateEntry = computed(() => toolbarItems.value.checkUpdates || props.hasUpdateAvailable);
const { isMac, isDesktop, showControls, isMaximized, isFullscreen, minimize, toggleMaximize, close } = useWindowControls();
const updateTooltip = computed(() => {
if (props.hasUpdateAvailable && props.updateReady) return t("updates.restartRequiredTooltip");
@@ -194,7 +195,7 @@ const collapsibleRightItemDefs = computed(() => {
disabled: boolean;
}
const items: ItemDef[] = [];
if (toolbarItems.value.checkUpdates) {
if (showToolbarUpdateEntry.value) {
items.push({
key: "checkUpdates",
label: t("updates.check"),
@@ -620,7 +621,7 @@ const toolbarStyle = computed(() => {
<!-- Right-side items wrapped in overflow-aware container -->
<div ref="rightWrapper" class="flex min-w-0 items-center gap-1 overflow-hidden">
<template v-if="toolbarItems.checkUpdates">
<template v-if="showToolbarUpdateEntry">
<Tooltip>
<TooltipTrigger as-child>
<Button
@@ -22,6 +22,15 @@ describe("silent toolbar update icon", () => {
expect(source).toContain('t("updates.updateAction")');
});
it("keeps the update entry visible when the appearance setting is off but an update is available", () => {
const source = readFileSync(resolve(process.cwd(), "apps/desktop/src/components/layout/AppToolbar.vue"), "utf8");
expect(source).toContain("const showToolbarUpdateEntry = computed(() => toolbarItems.value.checkUpdates || props.hasUpdateAvailable);");
expect(source).toContain("if (showToolbarUpdateEntry.value) {");
expect(source).toContain('<template v-if="showToolbarUpdateEntry">');
expect(source).not.toContain('<template v-if="toolbarItems.checkUpdates">');
});
it("passes only opt-out component badges to their separate toolbar entries", () => {
const source = readFileSync(resolve(process.cwd(), "apps/desktop/src/App.vue"), "utf8");