From d4c07d79b356cd6363a1ab29f2b0207962ab4268 Mon Sep 17 00:00:00 2001 From: Lihua <1017343802@qq.com> Date: Tue, 27 Oct 2026 23:57:03 -0700 Subject: [PATCH] fix(workspace): let Back restore its source over an in-flight re-scope Scoping a remote source to a root starts a read of that source. Pressing Back to an entry that names another source and root before the read commits made the root-change effect prefer the in-flight request over the restored route, so the page re-read the remote source with the restored root and rewrote the URL back to it. The app commits a route's source only from a loaded source, so a route naming a different source than the loaded one came from Back/Forward. That restored source now outranks an in-flight re-scope; an in-flight source selection is still re-scoped when the route names the loaded source. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lihua <1017343802@qq.com> --- apps/presentation/dashboard/src/views/dashboard-page.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/presentation/dashboard/src/views/dashboard-page.tsx b/apps/presentation/dashboard/src/views/dashboard-page.tsx index 32138c160d..e5bd84ce45 100644 --- a/apps/presentation/dashboard/src/views/dashboard-page.tsx +++ b/apps/presentation/dashboard/src/views/dashboard-page.tsx @@ -3684,8 +3684,13 @@ export function DashboardPage() { // A history entry restores source and root together, so the route's // restored source outranks the source that is still loaded. Only when // the route names no source does the loaded source act as the fallback. - const target = requestedStatusUrl - ?? (search.statusUrl.trim() || (source.kind === "url" ? source.label : "")); + // The app commits the route only from a loaded source, so a route naming + // another source came from Back/Forward; it also outranks a re-scope of + // the loaded source that is still in flight. + const routeUrl = search.statusUrl.trim(); + const routeRestoresSource = source.kind === "url" && routeUrl !== "" && routeUrl !== source.label; + const target = routeRestoresSource ? routeUrl : requestedStatusUrl + ?? (routeUrl || (source.kind === "url" ? source.label : "")); void loadFromUrl(target || defaultGlobalStatusUrl); return; }