fix(desktop): sync sidebar update card copy with global installing state (#1827)

Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
Co-authored-by: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@sprout-oss.stage.blox.sqprod.co>
This commit is contained in:
Will Pfleger
2026-07-13 17:38:32 -04:00
committed by GitHub
co-authored by npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7
parent 34dcd13d55
commit b63a2e4231
2 changed files with 56 additions and 5 deletions
@@ -21,7 +21,7 @@ export function SidebarUpdateCompactCard({
onDismiss,
testId = "sidebar-update-card-compact",
}: SidebarUpdateCompactCardProps) {
const { installAndRelaunch } = useUpdaterContext();
const { installAndRelaunch, status } = useUpdaterContext();
const [isUpdatePending, setIsUpdatePending] = React.useState(false);
const updatePendingRef = React.useRef(false);
const updateFrameRef = React.useRef<number | null>(null);
@@ -62,21 +62,23 @@ export function SidebarUpdateCompactCard({
});
}, [installAndRelaunch]);
const pending = isUpdatePending || status.state === "installing";
return (
<SidebarCompactActionCard
actionAriaLabel="Update now"
actionDisabled={isUpdatePending}
actionDisabled={pending}
actionTestId={actionTestId}
description={isUpdatePending ? "Updating" : "Click to update"}
description={pending ? "Updating" : "Click to update"}
dismissLabel="Dismiss update notification"
icon={
isUpdatePending ? (
pending ? (
<Spinner aria-hidden="true" className="h-5 w-5 border-2" />
) : (
<CircleArrowUp aria-hidden="true" className="h-5 w-5" />
)
}
iconKey={isUpdatePending ? "pending" : "idle"}
iconKey={pending ? "pending" : "idle"}
onAction={handleUpdate}
onDismiss={onDismiss}
testId={testId}
+49
View File
@@ -328,6 +328,55 @@ test("shows a sidebar update card when an update is ready", async ({
);
});
// Regression test for the sidebar card not reflecting an install started from
// another surface (follow-up to #1820). The header UpdateIndicator and the
// sidebar compact card both render in the "ready" state; starting the install
// from the header must flip the sidebar card's copy too, not just the header's.
test("reflects an install started from the header update button on the sidebar card", async ({
page,
}) => {
await page.goto("/");
await expect(page.getByTestId("app-sidebar")).toBeVisible();
await page.evaluate(() => {
const testWindow = window as Window & {
__BUZZ_E2E__?: { mock?: { updateAvailable?: boolean } };
};
testWindow.__BUZZ_E2E__ = {
...(testWindow.__BUZZ_E2E__ ?? {}),
mock: {
...(testWindow.__BUZZ_E2E__?.mock ?? {}),
restartDelayMs: 500,
updateAvailable: true,
},
};
});
await page.getByTestId("sidebar-profile-card").click();
await page.getByTestId("profile-popover-settings").click();
await page.getByTestId("settings-nav-updates").click();
await page.getByRole("button", { name: "Check for Updates" }).click();
await expect(page.getByTestId("settings-panel-updates")).toContainText(
"Update downloaded. Click to apply.",
);
await page.getByTestId("settings-back-to-app").click();
await page.getByTestId("channel-general").click();
const updateCard = page.getByTestId("sidebar-update-card");
await expect(updateCard).toBeVisible();
await expect(updateCard).toContainText("Click to update");
await page
.getByTestId("chat-header")
.getByRole("button", { name: "Update now" })
.click();
await expect(updateCard).toContainText("Updating");
await expect(page.getByTestId("sidebar-update-now")).toBeDisabled();
});
// Regression test for the Linux .deb auto-update guard (PR #1535).
// When auto-update is not supported (e.g. Linux .deb install), the update
// check must surface a "manual-required" card with a GitHub link and