From 9fc9ed87f1e2d7af835ec734fe159d25513dd3de Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sun, 15 Nov 2026 19:08:18 +0900 Subject: [PATCH 1/3] fix(tools): resync result share links after locale and tool navigation --- site/src/components/tools/ShareBar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/src/components/tools/ShareBar.tsx b/site/src/components/tools/ShareBar.tsx index bde0a4ca..2fa5486b 100644 --- a/site/src/components/tools/ShareBar.tsx +++ b/site/src/components/tools/ShareBar.tsx @@ -118,7 +118,7 @@ export function ShareBar({ url, embedUrl, title, slug }: Props) { window.removeEventListener("popstate", sync); window.removeEventListener("pageshow", sync); }; - }, []); + }, [url, slug]); // Recheck shared-result state on locale/tool navigation. const enc = encodeURIComponent; // Keep optional embed attribution visible to readers without ranking-credit links. From a90c3d9faded8e5ae64ab2555a3245aa4ca7d965 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sun, 15 Nov 2026 19:08:44 +0900 Subject: [PATCH 2/3] test(tools): guard result-link state across client route changes --- .../sharebar-state-navigation.test.mjs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 site/scripts/sharebar-state-navigation.test.mjs diff --git a/site/scripts/sharebar-state-navigation.test.mjs b/site/scripts/sharebar-state-navigation.test.mjs new file mode 100644 index 00000000..c7cd9590 --- /dev/null +++ b/site/scripts/sharebar-state-navigation.test.mjs @@ -0,0 +1,20 @@ +import test from "node:test"; +import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; + +const share = readFileSync(new URL("../src/components/tools/ShareBar.tsx", import.meta.url), "utf8"); + +test("share state resynchronizes after URL or tool slug changes", () => { + assert.match(share, /setHasResultLink\(new URLSearchParams\(window\.location\.search\)\.has\("s"\)\)/); + assert.match(share, /\}, \[url, slug\]\);/); + for (const event of ["toolify:share-state-change", "popstate", "pageshow"]) { + assert.ok(share.includes(`window.addEventListener("${event}", sync)`), event + " listener"); + assert.ok(share.includes(`window.removeEventListener("${event}", sync)`), event + " cleanup"); + } +}); + +test("safe embed and tracked share attribution stay intact", () => { + assert.match(share, /buildToolEmbedSnippet\(title, embedUrl, url\)/); + assert.match(share, /socialShareUrl\(url, source\)/); + assert.match(share, /if \(isShareCancelled\(error\)\) return;/); +}); From 099f31ad8752adf342f02c1a02ec511caca00ee4 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sun, 15 Nov 2026 19:09:24 +0900 Subject: [PATCH 3/3] chore(tools): gate client navigation sharing state in site prebuild --- site/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/package.json b/site/package.json index 843d4bae..3769b038 100644 --- a/site/package.json +++ b/site/package.json @@ -9,7 +9,7 @@ "lint": "next lint", "typecheck": "tsc --noEmit", "fetch:rates": "tsx scripts/fetch-rates.ts", - "prebuild": "node --test scripts/workdays-faq-parity.test.mjs && node scripts/check-site-url.mjs && tsx scripts/fetch-rates.ts && node scripts/check-pressure-reference.mjs && node scripts/check-currency-rate-freshness.mjs", + "prebuild": "node --test scripts/workdays-faq-parity.test.mjs && node --test scripts/sharebar-state-navigation.test.mjs && node scripts/check-site-url.mjs && tsx scripts/fetch-rates.ts && node scripts/check-pressure-reference.mjs && node scripts/check-currency-rate-freshness.mjs", "sitemap": "tsx scripts/generate-sitemap.ts", "validate": "tsx scripts/validate.ts", "audit:seo": "tsx scripts/audit-seo.ts",