Repository navigation
fix(web): navigate once when a cold load redirects off-site - #5121
Closed
tale-code-bot wants to merge 1 commit into
Closed
tale-code-bot wants to merge 1 commit into
tale-code-bot wants to merge 1 commit into
Conversation
A cold load of /ui, /en/ui, /de/ui or /fr/ui that reaches the client (vite preview, a static host) ran the alias's off-site redirect twice: main.tsx's initial router.load() called location.replace, then mounting RouterProvider let its Transitioner load the route again and call it a second time while the first navigation was committing. Chromium committed one and left the other unsettled, so Playwright's toHaveURL waited on it until its timeout (Received "", "waiting for navigation to finish"): the flaky smoke check of #4553. main.tsx now skips the hash replay and the mount once the initial redirect is marked reloadDocument, keeping the prerendered page until the browser leaves. The smoke check covers every alias on a cold load with its query and requires exactly one document request to the guide; main.test.tsx pins the mount gate. Closes #4553
Contributor
|
The autonomous cycle now lands each task through the merge train instead of its own pull request ( |
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.
Task: TALE-95 on the Development board ("Web /ui redirect intermittently misses its expected destination in E2E"). Source issue: #4553.
Cause
A cold load of a UI-guide alias (
/ui,/en/ui,/de/ui,/fr/ui) that the client answers sends the document off-site twice. In CI that client isvite preview, which falls back to the prerendered home page because there is nodist/ui.html; production's server answers these aliases with a 301 instead.app/main.tsxawaitsrouter.load()before mounting. The alias'sbeforeLoadthrowsredirect({ href: 'https://ui.tale.dev' + search }). Router-core marks itreloadDocumentand callswindow.location.replace.main.tsxthen mounts<RouterProvider>anyway. ItsTransitionerrunsrouter.load()on mount, the redirect fires again, and a secondlocation.replacegoes to the same address while the first navigation is committing.In the failing attempts Chromium committed one navigation and left the other with response headers but no commit and no failure. Playwright 1.58's
toHaveURLfirst waits for the frame's pending navigation to finish, so it never compared the URL. HenceReceived: ""and the call logwaiting for " https://ui.tale.dev/" navigation to finish....Evidence
Job 113308797831 (run 37776436833, head
4d60debc9263784f98bd74b36d3a4e8576125126):smoke.spec.ts:263with exactly that message. Retry update dashboard ui (#508) #2 passed in 455 ms.playwright-report-web-attempt-1artifact (11550411996) has expired (HTTP 404).Six later runs, same pattern (first attempt and retry 1 fail, retry 2 passes), all with retained
playwright-report-web-attempt-1artifacts: 39308831526, 39534833719, 40604417755, 40609657664, 40612052605, 40622034139. That is 6 of the 69 web E2E jobs since 2026-10-19. Every retry-1 trace shows the same sequence:/uiis served the prerendered home page.https://ui.tale.dev/go out 14–21 ms apart, and both are fulfilled by the test's route.receive: -1), andtoHaveURLwaits on it for 20 s.Local reproduction. Setup:
vite preview,--workers=2 --retries=0.Results:
0da082051with the CI signature.router.load→router.navigate({ href: 'https://ui.tale.dev', replace: true })twice: the first time with React not mounted, the second after the Transitioner mounted. The first request is aborted (net::ERR_ABORTED)./ui/stub (trailing slash) went through the same path three times. Every one of those navigations kept the query.Fix
app/main.tsx: once the initial load has thrown a redirect markedreloadDocument,loadInitialRouteresolvesfalse. It skips the hash replay, which would also callrouter.load()again, and the mount. The document is already leaving, so the prerendered page stays until the browser goes.What still mounts as before:
/de/hardware-pricing→/de/pricing.Client navigation to an alias still goes through the routes unchanged; the Transitioner is already mounted there, so it redirects once.
Tests
app/main.test.tsxgains three cases:/ui?source=coldand for/de/ui?source=cold#introwith the page scrolled, loads once, does not replay the hash and does not mount.createRootcalled;loadcalled twice). Fix: 7/7 pass.tests/e2e/specs/smoke.spec.ts:/uicheck becomes a cold-load check of/ui,/en/ui,/de/uiand/fr/uiwith?source=cold.https://ui.tale.dev/?source=coldassertion, and adds a requirement of exactly one document request to the guide per alias.E2E results (first attempts only,
--retries=0):main.tsx/ui7,/fr/ui3,/en/ui2,/de/ui1)All 13 old-source failures were the pending-navigation timeout.
With the guide held, after the fix: each alias and the static
/ui/stub show one load, one navigate and one request, none aborted, and the query is kept.tests/manual/reference/automation.md(the/uirow) and the web README name the cold-load behaviour.Gates run locally, on this head
bun run --filter @tale/web typecheck: exit 0.bun run --filter @tale/web lint: exit 0.bun run --filter @tale/web test: 47 files, 1916 tests passed.bun run --filter @tale/web test:prerender: 821 passed.bun run lint:manual,bun run lint:conflictsandoxfmt --checkon the changed files: pass.--retries=0is still running locally; its result goes on the task.Not run
bun run checkas a whole (other workspaces,lint:links,test:ui): left to this PR's CI.docsandui-docsuse the same pre-mount load. They have no off-site redirect today, so they are not changed here.Closes #4553