Repository navigation
Fix historyPoppedToLocationWithRestoration Not a Function - #97
Merged
Merged
Conversation
Snapshots clone the live head, which still holds the inline Turbolinks stub from the page the session started on. Only wrapped hydration marked existing head scripts as already run, so after a native entry the first restore visit re-executed the stub and reset window.Turbolinks. The next history navigation then failed with `historyPoppedToLocationWithRestorationIdentifier is not a function`. - Record existing head scripts on native hydration too. - Keep the tracked-script baseline separate from script recording, so a native page's first merge into a tracked wrapped page still never reloads. - Guard the inline stub so it never replaces a started Turbolinks. - Add e2e: native -> wrapped -> wrapped -> back -> forward -> back. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
dajinchu
force-pushed
the
dc/fix-history-nav-stub-rerun
branch
from
September 18, 2026 16:54
f72bdd2 to
83cb4c2
Compare
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.
Fixes
Turbolinks.controller.historyPoppedToLocationWithRestorationIdentifier is not a functionon history navigation.How it happens
window.Turbolinksstub fromheadHtmlBegin.document.head, which still contains the stub.mergeHeadexecutes every head script not recorded as already run, so the stub runs again and replaces the realwindow.Turbolinks.onBeforeRoutecalls the method on the stub's controller, which doesn't have it.Root cause
Only wrapped hydration called
recordExistingHeadScripts(). Entering on a native page never recorded the scripts the browser had already run, so the stub looked new on restore.Fix
🤖 Generated with Claude Code