Repository navigation
refactor(web): one view registry drives the shell (PR 3) - #501
Merged
Merged
Conversation
… view entry PR 3 of the feature-architecture series. What a user sees is unchanged: the rail's order, labels and test IDs, and every permission redirect, are pinned by tests against what the hand-wired shell did. - app/features/viewIds.ts: the view ids (no imports, so the UI store can validate a persisted view cheaply); ActiveView derives from it. - app/features/featureRegistry.ts: WORKSPACE_VIEWS, typed Record<ActiveView, …> so a missing entry does not compile: rail button, who may see it, the fallback, the lazy entry, what to prefetch inside. railItems / redirectFor / prefetchView read it. - App.tsx renders WORKSPACE_VIEWS[activeView]; its five lazy constants, the hand-written redirect effect and the ternary chain are gone. - ActivityRail takes its buttons from railItems; viewLoaders.ts is gone. - Each feature's lazy entry is view.ts (sql-editor also viewPane.ts, so Monaco still loads alongside the view); Settings and Compare get small view wrappers in the app layer. - The test-ID extractor also reads app/features/*.ts, where the rail's IDs now live as data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: 0ed88397-0112-4c9f-863b-e7a6ec06116c) |
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.
PR 3 of the feature-architecture schedule. Nothing a user sees changes.
Before
A workspace view was wired in five places: the
ActiveViewunion,viewLoaders.ts,App.tsx(lazy constants, a redirect effect, a ternary chain), the rail's id→view/icon/test-id maps, anduiStore's persisted-view list.After
app/features/viewIds.ts: the ids. It has no imports, souiStorevalidates a persisted view without loading the registry.app/features/featureRegistry.ts:WORKSPACE_VIEWS: Record<ActiveView, …>, so TypeScript refuses a missing entry. Each entry holds:COMMUNITY_NAV, or its own)allowedandfallbackloadinsideprefetchApp.tsxrendersWORKSPACE_VIEWS[activeView];ActivityRailusesrailItems;main.tsxand the rail prefetch throughprefetchView.viewLoaders.tsis deleted.view.ts(access, utilities, workflow, sql-editor, lokee-weave), never its barrel. sql-editor also hasviewPane.ts, so Monaco still loads alongside the view rather than after it.app/features/*.ts, where the rail's IDs now live as data. The catalog has the same 1717 IDs.Tests
featureRegistry.test.ts(10), A/B-checked:COMMUNITY_NAVview*fileChecks
🤖 Generated with Claude Code
Note
Low Risk
Behavior-preserving shell refactor with dedicated tests for rail items and redirects; server-side authorization is unchanged.
Overview
Introduces a single workspace view registry (
viewIds.ts+featureRegistry.ts) so rail buttons, lazy loaders, prefetch (insidefor Monaco), and permission redirects live in one typedWORKSPACE_VIEWSmap instead of scattered acrossApp.tsx,ActivityRail, and deletedviewLoaders.ts.App.tsxbuilds one lazy component per view from the registry and renders viaredirectFor+ a genericViewwrapper, replacing the longactiveViewternary chain and inline redirectuseEffect.ActivityRailcallsrailItems(can)instead of local nav/icon/test-id maps. Features gain rootview.ts(and sql-editorviewPane.ts) lazy entries; Compare moves intoSyncWorkspace.tsx, settings intoSettingsView.tsx.uiStoreimportsActiveView/isActiveViewfromviewIds(no registry load on persist). E2E test IDs for rail workspace buttons are attributed tofeatureRegistryin the extractor and docs.featureRegistry.test.tslocks rail order, visibility, and redirects to match the old shell.Reviewed by Cursor Bugbot for commit 2e6fc5c. Bugbot is set up for automated code reviews on this repo. Configure here.