From 1999bbeda975c4ac8407fcb4cfd37b50c3b844be Mon Sep 17 00:00:00 2001 From: Anyexyz Date: Thu, 2 Apr 2026 12:25:09 +0800 Subject: [PATCH] fix: extract currentScript outside setTimeout to avoid null pointer --- packages/page-agent/src/demo.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/page-agent/src/demo.ts b/packages/page-agent/src/demo.ts index af6d668..516dd6f 100644 --- a/packages/page-agent/src/demo.ts +++ b/packages/page-agent/src/demo.ts @@ -17,9 +17,10 @@ const DEMO_MODEL = 'qwen3.5-plus' const DEMO_BASE_URL = 'https://page-ag-testing-ohftxirgbn.cn-shanghai.fcapp.run' const DEMO_API_KEY = 'NA' +const currentScript = document.currentScript as HTMLScriptElement | null + // in case document.x is not ready yet setTimeout(() => { - const currentScript = document.currentScript as HTMLScriptElement | null let config: PageAgentConfig if (currentScript) {