Compare commits

...
Author SHA1 Message Date
t3-code[bot]andWout Stiens b77d7b2183 fix(web): restart repeated update check spins
Co-authored-by: Wout Stiens <[email protected]>
2026-08-12 15:06:25 +00:00
t3-code[bot]andWout Stiens ff762f8aa3 fix(web): reset update check animation latch
Co-authored-by: Wout Stiens <[email protected]>
2026-08-12 14:58:46 +00:00
t3-code[bot]andWout Stiens 2cc713b3b3 fix(web): complete fast update check rotation
Co-authored-by: Wout Stiens <[email protected]>
2026-08-12 14:44:52 +00:00
3 changed files with 98 additions and 4 deletions

No files matched your search

@@ -0,0 +1,31 @@
import { RefreshCwIcon } from "lucide-react";
import type { AnimationEventHandler } from "react";
import { cn } from "../../lib/utils";
export function nextDesktopUpdateCheckAnimationKey(key: number) {
return key + 1;
}
export function shouldContinueDesktopUpdateCheckAnimation({
isChecking,
}: {
readonly isChecking: boolean;
}) {
return isChecking;
}
export function DesktopUpdateCheckIcon({
isAnimating,
onAnimationIteration,
}: {
readonly isAnimating: boolean;
readonly onAnimationIteration?: AnimationEventHandler<SVGSVGElement>;
}) {
return (
<RefreshCwIcon
className={cn("size-4", isAnimating && "animate-spin")}
onAnimationIteration={onAnimationIteration}
/>
);
}
@@ -0,0 +1,42 @@
import { renderToStaticMarkup } from "react-dom/server";
import { describe, expect, it } from "vite-plus/test";
import {
DesktopUpdateCheckIcon,
nextDesktopUpdateCheckAnimationKey,
shouldContinueDesktopUpdateCheckAnimation,
} from "./DesktopUpdateCheckIcon";
describe("DesktopUpdateCheckIcon", () => {
it("keeps the refresh icon spinning while a fast update check settles", () => {
const markup = renderToStaticMarkup(<DesktopUpdateCheckIcon isAnimating />);
expect(markup).toContain("animate-spin");
});
it("does not animate while idle", () => {
const markup = renderToStaticMarkup(<DesktopUpdateCheckIcon isAnimating={false} />);
expect(markup).not.toContain("animate-spin");
});
it("keeps status-driven checks spinning across rotations", () => {
expect(
shouldContinueDesktopUpdateCheckAnimation({
isChecking: true,
}),
).toBe(true);
});
it("releases the manual animation latch after one rotation", () => {
expect(
shouldContinueDesktopUpdateCheckAnimation({
isChecking: false,
}),
).toBe(false);
});
it("restarts the animation for each manual check", () => {
expect(nextDesktopUpdateCheckAnimationKey(2)).toBe(3);
});
});
@@ -1,5 +1,5 @@
import { DownloadIcon, RefreshCwIcon, RotateCwIcon, TriangleAlertIcon } from "lucide-react";
import { useCallback, useState } from "react";
import { DownloadIcon, RotateCwIcon, TriangleAlertIcon } from "lucide-react";
import { useCallback, useEffect, useState } from "react";
import { isElectron } from "../../env";
import { cn } from "../../lib/utils";
import { ensureLocalApi } from "../../localApi";
@@ -21,6 +21,11 @@ import { Alert, AlertDescription, AlertTitle } from "../ui/alert";
import { Separator } from "../ui/separator";
import { SidebarMenuItem } from "../ui/sidebar";
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
import {
DesktopUpdateCheckIcon,
nextDesktopUpdateCheckAnimationKey,
shouldContinueDesktopUpdateCheckAnimation,
} from "./DesktopUpdateCheckIcon";
function keyReleaseNoteItems(items: ReadonlyArray<string>) {
const occurrences = new Map<string, number>();
@@ -110,6 +115,12 @@ export function SidebarUpdatePill() {
function SidebarUpdateControl() {
const state = useDesktopUpdateState();
const [isActionPending, setIsActionPending] = useState(false);
const [checkAnimationKey, setCheckAnimationKey] = useState(0);
const [isCheckIconAnimating, setIsCheckIconAnimating] = useState(false);
useEffect(() => {
if (state?.status === "checking") setIsCheckIconAnimating(true);
}, [state?.status]);
const action = state ? resolveDesktopUpdateButtonAction(state) : "none";
const isDownloading = state?.status === "downloading";
@@ -209,6 +220,8 @@ function SidebarUpdateControl() {
return;
}
setIsCheckIconAnimating(true);
setCheckAnimationKey(nextDesktopUpdateCheckAnimationKey);
void bridge
.checkForUpdate()
.then((result) => {
@@ -234,6 +247,12 @@ function SidebarUpdateControl() {
.finally(() => setIsActionPending(false));
}, [action, disabled, isActionPending, state]);
const handleCheckAnimationIteration = useCallback(() => {
setIsCheckIconAnimating(
shouldContinueDesktopUpdateCheckAnimation({ isChecking: state?.status === "checking" }),
);
}, [state?.status]);
return (
<SidebarMenuItem className="ml-auto shrink-0">
<Tooltip>
@@ -257,8 +276,10 @@ function SidebarUpdateControl() {
) : isUpdateState ? (
<DownloadIcon className="size-4" />
) : (
<RefreshCwIcon
className={cn("size-4", state?.status === "checking" && "animate-spin")}
<DesktopUpdateCheckIcon
key={checkAnimationKey}
isAnimating={isCheckIconAnimating}
onAnimationIteration={handleCheckAnimationIteration}
/>
)}
</button>