Files
sencho/.pr-body-tmp.md
T
Anso 5fe0843eb2 feat: add routable browser URLs for stacks and shell views (#1586)
* feat: add routable browser URLs for stacks and shell views

Sync in-memory navigation to the address bar via a History API hook so
deep links, refresh, Back/Forward, and bookmarks work across nodes,
views, stack editor tabs, and mobile surfaces. Gate role/tier URL
normalization on permissions and license readiness, preserve URLs on
metadata fetch failure, and surface retryable stack-list errors without
rewriting pending stack paths.

* fix: preserve deep-link views on cold load and refresh

Stop the node-switch effect from resetting to dashboard on initial mount.

Defer URL writer settlement until hydrated activeView matches the route.

Adds E2E coverage for shell cold loads, stack refresh, and compose env tab.

* fix: keep mobile dashboard on list surface so sidebar renders

On mobile, the URL sync hook was routing /nodes/<slug>/dashboard to the
content surface, hiding the stack list sidebar. This prevented the
data-stacks-loaded sentinel from appearing, causing sidebar truncation
E2E tests to time out after reload on a mobile viewport.

Mobile dashboard now stays on the list surface; other non-editor views
still render on the content surface.

* fix: complete mobile URL routing follow-ups for stack deep links

Restore mobile /dashboard vs /stacks, list surface always writes /stacks.

Hydrate pendingDetailStack, freeze compose failures with routeDetailError,

and add unit plus E2E coverage.

* fix: hydrate shell views from URL and sync in-app navigation

Bootstrap activeView and tab state from the pathname on cold load.

Settle route phase when state already matches, normalize unknown segments,

and open Monaco editor tabs from stack deep links via applyEditorRouteState.

* fix: prevent mobile stack deep links from hanging on cold load

The resolvePendingStack effect did not re-fire when the pending stack ref
was populated during URL hydration, because the urlHydratingStack state
set in the same callback was not listed in the effect's dependency array.
Adding it causes the effect to retry once hydration has committed.

A resolvingRef mutex prevents concurrent invocations. When the target file
is already loaded, route state is applied directly without calling
loadFileForRoute, which avoids unmounting the editor (and hiding the
recovery chip) if a background refresh triggers route resolution during
a deploy operation.

* test: adapt stack, deploy, and sidebar e2e specs to routable stack URLs

* ci: raise E2E Playwright job timeout to 20 minutes
2026-07-08 13:07:16 -04:00

2.1 KiB

Summary

  • Add a History API sync layer (useUrlSync) that maps shell state to /nodes/<slug>/... paths without react-router.
  • Gate URL normalization on permissions and license readiness; preserve the current URL on authz read failures (fail closed).
  • Add stack-list frozen error UI with retry, transition-specific dirty guards for popstate, and user docs at docs/features/deep-links.mdx.
  • Fix cold-load/refresh regressions: skip dashboard reset on initial node mount; defer URL writer until hydrated activeView matches the route.
  • Mobile URL contract: /dashboard opens Home (content surface); /stacks opens the stack list. List surface always writes /stacks even when activeView is Fleet or Resources.
  • Mobile stack deep links: hydrate pendingDetailStack, use loadFileForRoute + routeDetailError for compose failures (frozen URL, MobileDetailError + Retry).
  • QA follow-up (20b35df7): Bootstrap activeView/tabs from URL via readUrlRouteState so Fleet/Security/Resources cold-load correctly; settle route phase when state already matches (fixes in-app URL writes); normalize unknown view segments; open Monaco editor tabs from /compose//env//files deep links.

Test plan

  • cd frontend && npx tsc -b --noEmit
  • Unit: readUrlRouteState, useUrlSync, senchoRoute, useViewNavigationState (52+ tests)
  • E2E routing spec expanded (shell view content assertions, mobile cases) — re-run on CI / fresh preview
  • Manual QA on rebuilt preview image:
    • Cold load /nodes/local/fleet, /security/images, /resources (correct view, not Dashboard)
    • Dashboard → Fleet → Security updates address bar
    • /stacks/<name>/env opens Monaco env tab (not Anatomy-only)
    • /nodes/local/not-a-view normalizes to dashboard
    • Mobile stack deep link + compose failure retry (from prior commit)

Notes

  • Internal architecture docs are local-only (gitignored), not in this PR.
  • Anatomy panel sub-tabs remain URL-opaque; only Monaco editor tabs update the path.
  • Remote node slug suffix (name-id) is existing nodeSlug behavior; not changed in this PR.