fix(web): restart repeated update check spins

Co-authored-by: Wout Stiens <[email protected]>
This commit is contained in:
t3-code[bot]andWout Stiens committed 2026-08-12 15:06:25 +00:00
1 parent ff762f8aa3
commit b77d7b2183
3 files changed
+13

No files matched your search

@@ -3,6 +3,10 @@ import type { AnimationEventHandler } from "react";
import { cn } from "../../lib/utils";
export function nextDesktopUpdateCheckAnimationKey(key: number) {
return key + 1;
}
export function shouldContinueDesktopUpdateCheckAnimation({
isChecking,
}: {
@@ -3,6 +3,7 @@ import { describe, expect, it } from "vite-plus/test";
import {
DesktopUpdateCheckIcon,
nextDesktopUpdateCheckAnimationKey,
shouldContinueDesktopUpdateCheckAnimation,
} from "./DesktopUpdateCheckIcon";
@@ -34,4 +35,8 @@ describe("DesktopUpdateCheckIcon", () => {
}),
).toBe(false);
});
it("restarts the animation for each manual check", () => {
expect(nextDesktopUpdateCheckAnimationKey(2)).toBe(3);
});
});
@@ -23,6 +23,7 @@ import { SidebarMenuItem } from "../ui/sidebar";
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
import {
DesktopUpdateCheckIcon,
nextDesktopUpdateCheckAnimationKey,
shouldContinueDesktopUpdateCheckAnimation,
} from "./DesktopUpdateCheckIcon";
@@ -114,6 +115,7 @@ export function SidebarUpdatePill() {
function SidebarUpdateControl() {
const state = useDesktopUpdateState();
const [isActionPending, setIsActionPending] = useState(false);
const [checkAnimationKey, setCheckAnimationKey] = useState(0);
const [isCheckIconAnimating, setIsCheckIconAnimating] = useState(false);
useEffect(() => {
@@ -219,6 +221,7 @@ function SidebarUpdateControl() {
}
setIsCheckIconAnimating(true);
setCheckAnimationKey(nextDesktopUpdateCheckAnimationKey);
void bridge
.checkForUpdate()
.then((result) => {
@@ -274,6 +277,7 @@ function SidebarUpdateControl() {
<DownloadIcon className="size-4" />
) : (
<DesktopUpdateCheckIcon
key={checkAnimationKey}
isAnimating={isCheckIconAnimating}
onAnimationIteration={handleCheckAnimationIteration}
/>