Repository navigation
Let Turbo visit sign-in pages instead of reloading them - #55
Merged
Merged
Conversation
henrikbjorn
force-pushed
the
turbo-visits
branch
2 times, most recently
from
November 12, 2026 11:44
8950f85 to
dd2d4bf
Compare
The script tag carried data-turbo-track="reload", so any Turbo visit to or from a page with the widget became a full page load. Tracking is for assets whose URL changes on deploy; this one never does, and Turbo already appends and runs a new head script on a visit. On such a visit the script arrives after the controller connects, so the controller waits for the script's load event. A page restored from Turbo's cache still holds the old widget and its spent token, so render clears the element first.
henrikbjorn
force-pushed
the
turbo-visits
branch
from
November 12, 2026 11:44
dd2d4bf to
4be39f9
Compare
Merged
henrikbjorn
added a commit
that referenced
this pull request
Nov 12, 2026
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.
The script tag had
data-turbo-track="reload". Turbo compares the tracked tags in<head>on every visit and reloads the whole page when they differ, so any Turbo visit to or from a page with the widget became a full page load. Tracking is meant for assets whose URL changes on deploy. The Cloudflare URL never does, and Turbo already appends and runs a new head script on a visit.Without the reload, two things change for the controller:
turnstileis still undefined. Turbo 8'smergeHeadwaits only for stylesheets. The controller now waits for the script'sloadevent, using thedata-turnstiledattribute the tag now carries to find it.renderempties the element first.Checked in Tavle with this branch as a path gem, Tavle's own controller replaced by this one, and the Turnstile script delayed by 1 s so it really arrives after
connect:Alternatives tried for the cached page:
data-turbo-temporaryon the widgetturbo-cache-control: no-cachein the app's layoutreplaceChildren()(this PR)🤖 Generated with Claude Code