Skip to content

refactor: tangent - migrate tangetproectcontext onto mobx - #2730

Open
maxy-shpfy wants to merge 1 commit into
09-16-feat_tangent_-_keep_track_of_open_tabs_while_switching_sessions_inside_projectfrom
09-16-refactor_tangent_-_migrate_tangetproectcontext_onto_mobx
Open

maxy-shpfy wants to merge 1 commit into
09-16-feat_tangent_-_keep_track_of_open_tabs_while_switching_sessions_inside_projectfrom
09-16-refactor_tangent_-_migrate_tangetproectcontext_onto_mobx

Conversation

@maxy-shpfy

@maxy-shpfy maxy-shpfy commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Description

Extracts the Tangent project shell's UI state out of TangentProjectContext and into a new MobX-based TangentProjectStore class. Previously, all session, chat tab, and workarea tab logic lived as a large collection of React state, refs, and functions inside the context provider. The store now owns this state as observable properties, making it the single source of truth for which session is active and each session's chat and workarea tabs.

Key changes:

  • TangentProjectStore replaces the inline context value, exposing observable computed properties (activeSessionId, workareaTabs, chatTabs, etc.) and actions (selectSession, openAgent, closeChatTab, openResolvedView, closeWorkareaTab, etc.)
  • Components that previously destructured many values from useTangentProject() now access the store directly and are wrapped with MobX observer so they re-render reactively
  • Server data (project details, resources, sessions list) is moved out of the context entirely and fetched directly in the components that need it (ResourcesWindowContent, ProjectHeader, SessionsWindowContent)
  • AttachResourceInput, ProjectResourceKind, and ProjectResourceItem types are relocated to the files where they are used rather than being exported from the context
  • useTangentSessionTabs hook and its test file are deleted; the equivalent logic now lives in TangentProjectStore
  • TangentProjectAgentProvider no longer maintains a depsRef and a getActiveTabBridgeRef; instead it reads directly from the store instance, which MobX keeps current
  • onError callbacks in components are replaced with direct calls to useToastNotification
  • A comprehensive test suite for TangentProjectStore is added covering chat tabs, workarea tabs, bridge resolution, and environment waiting

Screenshots (if applicable)

Test Instructions

  1. Open a Tangent project and verify sessions can be started and switched between, with each session's chat and workarea tabs restored correctly on switch.
  2. Open pipeline resources from the resources dock and confirm they open in the workarea and that removing a resource works.
  3. Send a chat message and confirm the session is not auto-discarded on switch; switch away from a never-prompted session and confirm it is discarded.
  4. Open an agent sub-tab, close it, and verify fallback to the Chat tab.
  5. Run the new TangentProjectStore.test.ts suite to confirm all unit tests pass.

Additional Comments

Server-fetched data (project, resources, sessions) intentionally remains in TanStack Query and is not moved into the store. The store owns only UI state that multiple parts of the shell and the out-of-render agent tools need to share.

@github-actions

github-actions Bot commented Sep 17, 2026

Copy link
Copy Markdown

🎩 Preview

A preview build has been created at: 09-16-refactor_tangent_-_migrate_tangetproectcontext_onto_mobx/17587d6

maxy-shpfy commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@maxy-shpfy
maxy-shpfy force-pushed the 09-16-refactor_tangent_-_migrate_tangetproectcontext_onto_mobx branch from ca8eb50 to f760f32 Compare September 18, 2026 18:52
@maxy-shpfy
maxy-shpfy force-pushed the 09-16-feat_tangent_-_keep_track_of_open_tabs_while_switching_sessions_inside_project branch 2 times, most recently from f6fa66c to f7cfa0b Compare September 18, 2026 19:13
@maxy-shpfy
maxy-shpfy force-pushed the 09-16-refactor_tangent_-_migrate_tangetproectcontext_onto_mobx branch from f760f32 to f9b1020 Compare September 18, 2026 19:13
@maxy-shpfy
maxy-shpfy force-pushed the 09-16-feat_tangent_-_keep_track_of_open_tabs_while_switching_sessions_inside_project branch from f7cfa0b to be4b27c Compare September 18, 2026 19:18
@maxy-shpfy
maxy-shpfy force-pushed the 09-16-refactor_tangent_-_migrate_tangetproectcontext_onto_mobx branch from f9b1020 to daf14be Compare September 18, 2026 19:18
@maxy-shpfy
maxy-shpfy force-pushed the 09-16-feat_tangent_-_keep_track_of_open_tabs_while_switching_sessions_inside_project branch from be4b27c to b799a06 Compare September 18, 2026 19:28
@maxy-shpfy
maxy-shpfy force-pushed the 09-16-refactor_tangent_-_migrate_tangetproectcontext_onto_mobx branch from daf14be to 17587d6 Compare September 18, 2026 19:28
@maxy-shpfy
maxy-shpfy marked this pull request as ready for review September 18, 2026 19:35
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.

1 participant