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",