fix: username claim no longer refreshes to an empty form - #36
Merged
Conversation
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>
Deploying with
|
| 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
marked this pull request as ready for review
August 13, 2026 06:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Signup on
/startwas 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 noname, so the reload looked like “nothing happened”).selectedon the country<option>added a hydration mismatch on top.Fix
onSubmitso listeners survive hydration.method="dialog"on the form so a pre-hydration submit cannot navigate away.username,country,profile-url) anddefaultValue=""on the country select instead ofselectedon the placeholder option.?render=explicit) so the widget is not lost when React replaces the implicitcf-turnstilediv.Tests
/startHTML: named fields,method="dialog", no inlineaddEventListener('submit', noselectedon<option>.