Skip to content

fix: username claim no longer refreshes to an empty form - #36

Merged
jackmcpickle merged 2 commits into
mainfrom
cursor/fix-signup-claim-df3c
Aug 13, 2026
Merged

fix: username claim no longer refreshes to an empty form#36
jackmcpickle merged 2 commits into
mainfrom
cursor/fix-signup-claim-df3c

Conversation

@jackmcpickle

Copy link
Copy Markdown
Owner

Problem

Signup on /start was broken after the TanStack Start migration: enter a username and country, click Claim username, and the page refreshed with an empty form. Console showed hydration errors.

The claim form attached its submit handler with an inline <script> during HTML parse. React hydration then replaced those DOM nodes and dropped the listener. Claim fell through to a native GET (the username field also had no name, so the reload looked like “nothing happened”). selected on the country <option> added a hydration mismatch on top.

Fix

  • Handle claim, tabs, copy, and Turnstile as React state/onSubmit so listeners survive hydration.
  • method="dialog" on the form so a pre-hydration submit cannot navigate away.
  • Named fields (username, country, profile-url) and defaultValue="" on the country select instead of selected on the placeholder option.
  • Explicit Turnstile render after mount (?render=explicit) so the widget is not lost when React replaces the implicit cf-turnstile div.

Tests

  • Claim snippet helper coverage.
  • /start HTML: named fields, method="dialog", no inline addEventListener('submit', no selected on <option>.
Open in Web Open in Cursor 

The /start form attached its submit handler with an inline script that
ran during HTML parse. React hydration then replaced those DOM nodes,
so Claim username did a native GET and the page refreshed empty.

Handle claim, tabs, copy, and Turnstile in React instead, and use
method=dialog plus named fields so submit cannot navigate away.

Co-authored-by: Jack McNicol <jackmcpickle@users.noreply.github.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 13, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
tokentally d5cf900 Aug 13 2026, 06:51 AM

Read field values from React state instead of FormData/HTMLInputElement.value,
and avoid RequestInit.credentials and scrollIntoView which Cloudflare's
types do not include.

Co-authored-by: Jack McNicol <jackmcpickle@users.noreply.github.com>
@jackmcpickle
jackmcpickle marked this pull request as ready for review August 13, 2026 06:50
@jackmcpickle
jackmcpickle merged commit 680fc5f into main Aug 13, 2026
5 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.

2 participants