From 6622d27cbdc9105ee7902d2f48ba76799479ac12 Mon Sep 17 00:00:00 2001 From: Bernard Allotey Date: Tue, 7 Jul 2026 13:52:14 -0400 Subject: [PATCH 1/2] chore: add Safari dev script --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index ea8db47..aaaccc3 100755 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "type": "module", "scripts": { "dev": "wxt", + "dev:safari": "wxt -b safari", "build": "wxt build", "zip": "wxt zip", "lint": "oxlint", From b558f771ba10b3bfd4bafa8be6d2fd7a4dfebcad Mon Sep 17 00:00:00 2001 From: Bernard Allotey Date: Tue, 7 Jul 2026 13:53:00 -0400 Subject: [PATCH 2/2] fix: fall back when requestIdleCallback is unavailable --- AGENTS.md | 5 +++++ package.json | 4 ++-- src/entrypoints/content/index.tsx | 11 ++++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..ab99fb2 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,5 @@ +# Agent Instructions + +## Pull Requests + +- PR titles must follow conventional commit format, such as `fix: handle Safari without requestIdleCallback`. diff --git a/package.json b/package.json index aaaccc3..40802d3 100755 --- a/package.json +++ b/package.json @@ -1,15 +1,15 @@ { "name": "transit-easy", "displayName": "TransitEasy", - "version": "2.0.0", + "version": "2.0.1", "private": "true", "description": "Chrome Extension that allows you to see transit directions for listings on StreetEasy", "license": "MIT", "type": "module", "scripts": { "dev": "wxt", - "dev:safari": "wxt -b safari", "build": "wxt build", + "build:safari": "wxt build -b safari", "zip": "wxt zip", "lint": "oxlint", "lint:fix": "oxlint --fix", diff --git a/src/entrypoints/content/index.tsx b/src/entrypoints/content/index.tsx index 7e4cd63..2a6638d 100644 --- a/src/entrypoints/content/index.tsx +++ b/src/entrypoints/content/index.tsx @@ -50,9 +50,18 @@ export default defineContentScript({ subtree: true, }); - requestIdleCallback(mount); + const cancelInitialMount = (() => { + if (typeof window.requestIdleCallback === "function") { + const handle = window.requestIdleCallback(mount); + return () => window.cancelIdleCallback(handle); + } + + const handle = window.setTimeout(mount, 0); + return () => window.clearTimeout(handle); + })(); ctx.onInvalidated(() => { + cancelInitialMount(); observer.disconnect(); cleanup(); });