diff --git a/packages/web/lib/components/vton/VtonModal.tsx b/packages/web/lib/components/vton/VtonModal.tsx index 24ea067b..05c030b4 100644 --- a/packages/web/lib/components/vton/VtonModal.tsx +++ b/packages/web/lib/components/vton/VtonModal.tsx @@ -150,14 +150,14 @@ export function VtonModal() { }, [backgroundJob?.status]); // Abort on unmount - useEffect( - () => () => { + useEffect(() => { + mountedRef.current = true; + return () => { mountedRef.current = false; fileSelectRequestIdRef.current += 1; abortControllerRef.current?.abort(); - }, - [] - ); + }; + }, []); const { handleTryOn, diff --git a/packages/web/lib/components/vton/VtonPhotoArea.tsx b/packages/web/lib/components/vton/VtonPhotoArea.tsx index 614059bc..e2ddf6af 100644 --- a/packages/web/lib/components/vton/VtonPhotoArea.tsx +++ b/packages/web/lib/components/vton/VtonPhotoArea.tsx @@ -105,9 +105,9 @@ export function VtonPhotoArea({ setConsentOpen(true); }; - const handleConsentAccept = async () => { + const handleConsentAccept = () => { const intent = pendingIntent; - await persistVtonPhotoConsent(undefined, { + void persistVtonPhotoConsent(undefined, { policySnapshot: { source: "vton_modal", locale: diff --git a/packages/web/lib/components/vton/__tests__/VtonLab.test.tsx b/packages/web/lib/components/vton/__tests__/VtonLab.test.tsx index 45b49b12..bb4b85e8 100644 --- a/packages/web/lib/components/vton/__tests__/VtonLab.test.tsx +++ b/packages/web/lib/components/vton/__tests__/VtonLab.test.tsx @@ -1,5 +1,6 @@ /* @vitest-environment jsdom */ +import { StrictMode } from "react"; import { fireEvent, render, screen, waitFor } from "@testing-library/react"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { VtonLab } from "../VtonLab"; @@ -223,9 +224,7 @@ describe("VtonLab", () => { expect(localStorage.getItem(VTON_PHOTO_CONSENT_KEY)).toContain( '"version":"v1"' ); - await waitFor(() => { - expect(inputClickSpy).toHaveBeenCalledTimes(1); - }); + expect(inputClickSpy).toHaveBeenCalledTimes(1); }); it("gates Gallery through consent and leaves the VTON modal open when declined", async () => { @@ -491,10 +490,10 @@ describe("VtonLab", () => { }); const { container } = render( - <> + - + ); await waitFor(() => {