fix(browser-sync): reflect the step path in the address bar - #3
Open
a22hobman wants to merge 1 commit into
Open
Conversation
useJourneyBrowserSync computed each history entry's `path` (from the active top step) but passed "" as the pushState/replaceState URL argument, so the browser kept the current address and the location bar never updated on in-app navigation. Deep-link and back/forward worked (state carries `path`), but the visible URL stayed stale — and consumers that read window.location (e.g. segment-based layout routers like strata, which cascades templates off URL segments) saw stale segments. Pass the entry's `path` as the third pushState/replaceState argument at all four sync sites (initial replaceState, forward push, workspace-switch push, in-place replace). State shape is unchanged, so popstate reconstruction is unaffected. Tests: updated the four browser-sync assertions to expect the URL arg; full suite 99/99 green, tsc clean, build OK.
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
useJourneyBrowserSyncalready computes each history entry'spath(from the active top step —hooks.tsmakeEntry), but everypushState/replaceStatecall passes""as the URL argument and omits the path:When you call
pushState/replaceStatewith no URL, the browser deliberately keeps the current address. So the location bar never updates on in-app navigation. Deep-linking and back/forward still work (state carriespath, andpopstatereconstructs fromdata.path), but:window.locationsee stale segments — notably segment-based layout routers (e.g. strata, which cascades templates → slots → components off URL segments) would cascade off the wrong, stale path.Fix
Pass the entry's
pathas the thirdpushState/replaceStateargument at all four sync sites (initialreplaceState, forward push, workspace-switch push, in-placereplace). The history state shape is unchanged, sopopstatereconstruction is unaffected; this only surfaces the path that was already being tracked.Tests
tsc --noEmitclean,tsupbuild OK.Notes
🤖 Generated with Claude Code