From 80481f7fc97eac4117cdc1ac7e761dc932952f0e Mon Sep 17 00:00:00 2001 From: Dotta Date: Wed, 24 Jun 2026 21:47:26 +0000 Subject: [PATCH] Fix watchdog callout test act helper --- ui/src/components/WatchdogStateCallout.test.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ui/src/components/WatchdogStateCallout.test.tsx b/ui/src/components/WatchdogStateCallout.test.tsx index c51097f1a1d..1fa27d41c1c 100644 --- a/ui/src/components/WatchdogStateCallout.test.tsx +++ b/ui/src/components/WatchdogStateCallout.test.tsx @@ -1,7 +1,7 @@ // @vitest-environment jsdom -import { act } from "react"; import type { ComponentProps, ReactNode } from "react"; +import { flushSync } from "react-dom"; import { createRoot, type Root } from "react-dom/client"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; @@ -33,6 +33,14 @@ vi.mock("@/api/issues", () => ({ let container: HTMLDivElement; let root: Root; +function act(callback: () => void | Promise) { + let result: void | Promise | undefined; + flushSync(() => { + result = callback(); + }); + return result; +} + const summary: IssueWatchdogSummary = { id: "wd-1", companyId: "co-1",