From 3209d1c941a16016ad15bc67385a7ef66f44e257 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Fri, 5 Sep 2025 10:15:28 +0200 Subject: [PATCH] =?UTF-8?q?chore(=F0=9F=90=99):=20Update=20timeouts=20in?= =?UTF-8?q?=20test=20client?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/example/src/Tests/Tests.tsx | 17 +++++++++-------- apps/example/src/Tests/useClient.ts | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/apps/example/src/Tests/Tests.tsx b/apps/example/src/Tests/Tests.tsx index e0c5129945..59e335b54d 100644 --- a/apps/example/src/Tests/Tests.tsx +++ b/apps/example/src/Tests/Tests.tsx @@ -1,3 +1,4 @@ +/* eslint-disable no-nested-ternary */ /* eslint-disable no-eval */ /* eslint-disable @typescript-eslint/no-explicit-any */ import { @@ -9,7 +10,7 @@ import { } from "@shopify/react-native-skia"; import type { RefObject } from "react"; import React, { useEffect, useRef, useState } from "react"; -import { PixelRatio, Text, View } from "react-native"; +import { PixelRatio, Platform, Text, View } from "react-native"; import type { SerializedNode } from "./deserialize"; import { parseNode, parseProps } from "./deserialize"; @@ -20,7 +21,7 @@ export const CI = process.env.CI === "true"; const s = 3; const scale = s / PixelRatio.get(); const size = 256 * scale; -const timeToDraw = CI ? 1500 : 500; +const timeToDraw = CI ? (Platform.OS === "ios" ? 1500 : 3000) : 500; interface TestsProps { assets: { [key: string]: any }; @@ -32,7 +33,7 @@ export const Tests = ({ assets }: TestsProps) => { const [client, hostname] = useClient(); const [drawing, setDrawing] = useState(null); const [screen, setScreen] = useState(null); - + useEffect(() => { if (client !== null) { // Define the message handler as a separate function @@ -66,16 +67,16 @@ export const Tests = ({ assets }: TestsProps) => { }; // Use addEventListener instead of onmessage - client.addEventListener('message', handleMessage); + client.addEventListener("message", handleMessage); // Clean up: remove the specific event listener return () => { - client.removeEventListener('message', handleMessage); + client.removeEventListener("message", handleMessage); }; } return; }, [assets, client]); - + useEffect(() => { if (drawing && client) { const it = setTimeout(() => { @@ -104,7 +105,7 @@ export const Tests = ({ assets }: TestsProps) => { } return; }, [client, drawing, ref]); - + useEffect(() => { if (screen && client) { const it = setTimeout(async () => { @@ -120,7 +121,7 @@ export const Tests = ({ assets }: TestsProps) => { } return; }, [client, screen]); - + return ( diff --git a/apps/example/src/Tests/useClient.ts b/apps/example/src/Tests/useClient.ts index 70b68f5e00..57e10535aa 100644 --- a/apps/example/src/Tests/useClient.ts +++ b/apps/example/src/Tests/useClient.ts @@ -35,7 +35,7 @@ export const useClient = (): UseClient => { ws.close(); // incrementing retry to rerun the effect setRetry((r) => r + 1); - }, 500); + }, 3000); }; return () => { ws.close();