Skip to content

fix(home): keep the URL clean until the user edits#13

Merged
dani-polani merged 1 commit into
mainfrom
fix/home-clean-url-on-idle
Jul 5, 2026
Merged

fix(home): keep the URL clean until the user edits#13
dani-polani merged 1 commit into
mainfrom
fix/home-clean-url-on-idle

Conversation

@dani-polani

Copy link
Copy Markdown
Member

Problem

Opening / (even by a crawler, with no interaction) rewrote the address to /?data=<default state> via history.replaceState ~400ms after load. To Googlebot's renderer this reads like the home page redirecting to a data URL on load, which can keep / from being indexed. A separately-shared ?data= link was indexed instead (it self-canonicalizes), while / was not.

The server does not inject an example on a bare / — the default diagram is the store's built-in default, not a redirect. The only culprit is the client-side URL-sync effect firing for the initial state.

Fix

Skip the first run of the URL-sync effect (the initially loaded or default state) and only write ?data= once the project actually changes.

Behavior (verified in-browser)

  • Idle / after the debounce window → stays /
  • After a real edit → ?data=… appears; sharing and reload-safety unchanged ✅
  • /?example=<slug> idle → stays ?example=<slug>, no longer bloats into ?data= ✅ (also fixes the long-standing "URL grows on load" issue)

Checks

npm run check (0 errors), ESLint + Prettier clean, 121 tests passing.

Follow-up (not in this PR)

After deploy, request indexing of / in Search Console and check the Page Indexing report for the prior exclusion reason. Optionally, ?data=/?example= URLs could be set noindex to keep them out of the index / save crawl budget — left as-is since indexing shared links is acceptable.

🤖 Generated with Claude Code

The editor rewrote `/` to `?data=<default state>` 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=<slug>` 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) <noreply@anthropic.com>
@dani-polani dani-polani merged commit 3045082 into main Jul 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant