Skip to content

refactor(ui): extract parseRoute and add ViewScope with useView (RIG-4439) - #1652

Merged
trunk-io[bot] merged 1 commit into
mainfrom
compass-ui/rig-4439-view-scope
Oct 7, 2026
Merged

trunk-io[bot] merged 1 commit into
mainfrom
compass-ui/rig-4439-view-scope

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

This PR is part of a stack containing 7 PRs:

  1. main
  2. "refactor(ui): extract parseRoute and add ViewScope with useView (RIG-4439)" (this PR)
  3. refactor(ui): move routed surfaces and agent-workspace state onto the view scope (RIG-4442) #1675
  4. feat(ui): window layout model, hash sync and session persistence (RIG-4443) #1743
  5. feat(ui): view tab strip with keep-alive and open-in-tab links (RIG-4444) #1755
  6. feat(ui): W leader chords and palette commands for tabs and panes (RIG-4445) #1770
  7. feat(ui): two-pane split with a resizable splitter (RIG-4446) #1780
  8. fix(ui): chrome cleanup: drop ADE and usage bar, Session Log naming, pane edges, row re-measure (RIG-4771) #1811

T1 of the in-window tabs and split views record (docs/designs/ui/compass-in-window-tabs/design.md §T1). No user-visible change; no surface reads useView() yet (T2).

  • view-route.ts: RouteMatch, pure parseRoute (the parse applyRoute did inline; unknown path → Bridge) and its inverse routePath.
  • store.ts: applyRoute is now a switch over parseRoute. firstChannelId moves to module scope and takes channels, so the scope reuses it.
  • view-scope.ts: ViewScope, createViewScope, ViewContext, useView(). The pending-aware hold-then-fallback runs inside the scope and navigates only that view.

One behavior difference: on main, an unknown path left the routed state untouched until the router's * redirect to / landed. parseRoute maps it to the Bridge directly, which is where that redirect goes.

The store's applyChannelRoute/applyTopicRoute tests in routing.test.tsx stay. Production still runs that path until T2 moves surfaces onto the scope.

Tests

  • moon run compass-ui:test: 1212 pass, 0 fail. compass-ui:typecheck and stylelint pass; biome clean on the new files.
  • New cases (all pass): 7 parseRoute/routePath round-trips plus unknown→Bridge; 4 ViewScope cases for channel and topic hold-then-resolve and hold-then-fallback, each also asserting a second scope stays put; useView throws outside a provider.
  • Red check: with the scope's fallback disabled, both fallback cases fail.

Spec-impact: none.
Ledger-impact: none

Co-authored-by: Matt Wilkinson matt@rigel.build

@trunk-io

trunk-io Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

@linear-code

linear-code Bot commented Oct 4, 2026

Copy link
Copy Markdown

RIG-4439

@github-actions

github-actions Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Compass engineering docs preview: https://compass-ui-rig-4439-view-sco.compass-eng-docs.pages.dev

Deployed from compass-ui/rig-4439-view-scope at 0cb4119.

@rigel-mintaka
rigel-mintaka marked this pull request as ready for review October 4, 2026 19:43
…4439)

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@trunk-io

trunk-io Bot commented Oct 7, 2026

Copy link
Copy Markdown

This pull request is queued for merge as part of 1798, which will merge 1652, 1675, 1743, 1755, 1770, 1780, 1787, 1798.

@trunk-io
trunk-io Bot merged commit cc09f51 into main Oct 7, 2026
20 checks passed
@trunk-io
trunk-io Bot deleted the compass-ui/rig-4439-view-scope branch October 7, 2026 04:16
@trunk-io

trunk-io Bot commented Oct 7, 2026

Copy link
Copy Markdown

This pull request was merged into main as part of stacked PR 1798.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants