Refactor: Introduce Modular Workspace Surfaces#1959
Refactor: Introduce Modular Workspace Surfaces#1959justsomelegs wants to merge 9 commits intopingdotgg:mainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Needs human review This PR introduces a significant architectural refactor, replacing the existing diff panel routing with a new 'workspace surfaces' abstraction including a zustand store, reducer, surface definitions, and new URL state management. The ~1700 lines of additions create substantial new infrastructure for managing workspace layout and state, warranting human review of the design and implementation. You can customize Macroscope's approvability policy. Learn more. |
What Changed
This PR replaces the old route-local
chat + diffwiring with a real workspace surface system.Before this branch:
ChatView, and diff panel logic all knew too much about each otherterminalorgitwould require more one-off branchingAfter this branch:
Main additions:
WorkspaceProvider+WorkspaceShellown workspace state/renderingworkspace/surfaceDefinitions.tsxworkspace/surfaces/chatSurface.tsxworkspace/surfaces/diffSurface.tsxworkspaceRouteSearch.tsThis also rebases the original workspace branch work onto current
mainand carries forward the route-sync / optimistic-navigation hardening.Why
We want the app to behave more like a real workspace, not a chat page with one hardcoded special panel.
That matters because we already know more surfaces are coming:
gitviewdiffwithterminalin the same side panelThe old structure was okay for one special-case diff panel, but it would scale badly. Every new panel/tool would keep adding more route conditionals, more
ChatViewcoupling, and more duplicated “if this panel is open, do X” logic.This refactor gives us a cleaner extension point now, before
terminal/gitland.Concrete benefits
ChatViewno longer needs to know route/search-param details for diff.Example: opening a surface
Old mental model:
New mental model:
Example: toggling the side panel tool
Example: what adding a future surface looks like
A future
terminalorgit panelwould follow the same pattern:Then register it in one place:
That is the main payoff of this PR: the next surface becomes an addition, not another refactor.
URL behavior is now generic
Instead of diff-specific route handling being spread around, panel state is normalized through generic workspace route search:
That keeps the route model ready for future panel types.
UI Changes
No intentional visual redesign.
User-visible behavior should be the same overall, with the main changes being:
cleaner/safer diff panel routing
more reliable optimistic panel state during navigation
groundwork for future panel replacement (diff -> terminal, etc.)
Checklist
Note
Introduce modular workspace surfaces to manage diff panel state via a store instead of URL params
DiffPanelis refactored into a controlled component driven by surface focus props; focus changes propagate back to the workspace viaonFocusChangecallbacks rather than router navigation.panel/panelTurnId/panelFilePathsearch params for shareability, with optimistic transitions reconciled after router sync.Macroscope summarized 22e7b4d.