From 628a706db036c9932426069ada281fe82f78bd7a Mon Sep 17 00:00:00 2001 From: dani-polani Date: Sun, 5 Jul 2026 03:02:39 +0300 Subject: [PATCH] fix(home): keep the URL clean until the user edits The editor rewrote `/` to `?data=` via history.replaceState right after load, with no user action. To a crawler that reads like the home page redirecting to a data URL on load, which can keep `/` from being indexed. Skip the first run of the URL-sync effect (the initially loaded or default state) and only write `?data=` once the project actually changes. An idle `/` now stays `/`, and opening `/?example=` no longer bloats into a `?data=` URL either. Sharing and reload-safety after an edit are unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) --- bitext/src/routes/+page.svelte | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bitext/src/routes/+page.svelte b/bitext/src/routes/+page.svelte index fd4e928..f9e5d26 100644 --- a/bitext/src/routes/+page.svelte +++ b/bitext/src/routes/+page.svelte @@ -85,6 +85,10 @@ }); // Keep the URL in sync so the diagram is shareable / reload-safe. + // The first run is the initially loaded (or default) state: leave the URL + // untouched so an idle `/` stays clean. Crawlers otherwise see the page + // replaceState to `?data=…` on load, which reads like a redirect. + let urlSyncPrimed = false; let urlDebounce: ReturnType | undefined; $effect(() => { if (!browser || !hydrated) return; @@ -92,6 +96,10 @@ void projectStore.connections; void projectStore.pairControls; void settingsStore.settings; + if (!urlSyncPrimed) { + urlSyncPrimed = true; + return; + } clearTimeout(urlDebounce); urlDebounce = setTimeout(() => { const state: AppStateV2 = {