Files
fusion/packages/dashboard/app/components/ProjectSelector.css
gsxdsm 4f929acc10 fix(dashboard): stop over-aggressive component unmounts (keep-alive for planning, terminals, popups) (#2420)
Implements
docs/plans/2026-07-22-001-fix-dashboard-remount-churn-plan.md: every
confirmed source of unnecessary unmount/remount churn in the dashboard,
plus a keep-alive layer for conversation- and terminal-bearing surfaces.

## What changed

**Keying / component identity (U1–U3)**
- Streaming chat segment key no longer embeds `entries.length` — an
expanded thinking block stays expanded while entries stream into it
(R1).
- Dock task list keys `TaskCard` rows by `task.id` (occurrence suffix
only for the duplicate-id anomaly) instead of `id-index` — no remount on
reorder/filter/status change (R2).
- `ProviderStatusBadge` / `GitHubStatusBadge` hoisted out of
ModelOnboardingModal's render body (R3); MCP server rows key by
`server.name` alone (R4).

**Keep-alive layer (U4–U6)**
- New shared `KeepAliveView` wrapper: visible = in-flow flex child;
hidden = out-of-flow `position:absolute; inset:0` with
`visibility:hidden; pointer-events:none` + `aria-hidden` (never
`display:none`, so xterm geometry never collapses).
- Planning Mode renders as a kept-alive sibling of the MainContent
switch after first open (per-project latch mirroring Quick Chat). While
hidden, the session-list SSE, recovery poll, and elapsed ticker suspend
via a new `active` prop; reveal re-subscribes and refreshes the sessions
list once. Payload-carrying entry points (initial-plan handoff, resume)
and project switches remount via a new
`modalManager.planningEntryGeneration` key, preserving pre-keep-alive
fresh-open semantics. `recordResumeEvent` instrumentation records
`remount` on first activation and `route-active` on reveal.
- Task-detail Terminal / Worktree-terminal / Planner-chat tabs stay
mounted-but-hidden after first open (per-task latches; task switch/close
still disposes fully). `SessionTerminal` gains `active`: reveal refits +
forces a font remeasure, and if the WS died while hidden it re-runs the
full attach lifecycle (dead-socket recovery).
- Popped-out task windows hide via FloatingWindow `hidden` instead of
leaving the render array; `TaskDetailContent` gains `active` so hidden
popups close their SSE/EventSource channels while the terminal WS stays
open. `visiblePoppedOutTaskEntries` remains the Escape-shortcut
consumer.

**Planning Mode internal-transition audit (U7)**
- Audit findings: session-list mode and mobile list/detail flips are
CSS-class transitions over one always-mounted detail pane (no
state-discarding unmounts); re-selecting the active session is an
early-return visibility restore; session switching intentionally reloads
from the session row (stream re-attach for generating sessions);
remaining index keys are on stateless lists. No product-code defects
found; regression tests now lock the always-mounted invariant on desktop
+ mobile.

**Cheap-view state (U8)**
- CommandCenter (active sub-tab + date range) and DevServerView
(selected script/task + typed-but-unsent command) persist per project
via `modalPersistence` and restore after their (intentional) unmount
round-trips. Also fixed the candidate auto-fill effect clobbering a
customized non-empty command.

## Symptom Verification
- **Original symptom:** streaming thinking blocks collapsed mid-stream;
terminals reconnected and lost scroll/input on tab flips; Planning Mode
lost in-flight interviews on navigation; popped-out windows vanished
off-view; dock cards remounted on reorder.
- **Exact reproduction:** (1) expand a thinking block during a stream;
(2) run a command in the Terminal tab, flip to Plan and back; (3) start
a planning interview, navigate Board and back; (4) pop out a task with
board/list-only scoping and switch views; (5) change a dock task's
status.
- **Assertion it is gone:** component-identity/instrumentation tests in
TaskChatTab, SessionTerminal, TaskDetailModal
(worktree/planner-chat/tabs), PlanningModeModal keep-alive +
internal-transitions, App keep-alive round-trip, and
App.taskPopupViewGating assert no remount and preserved state for each
repro, across desktop and mobile breakpoints.

## Verification
- File-scoped vitest: 23 files / 1091 tests green (all touched suites
plus FloatingWindow, TerminalModal, TaskPlannerChatTab,
lazy-loaded-views guard, App suites).
- `pnpm verify:fast`: PASS (13 steps — scoped typecheck/build, CLI
build, boot smoke).
- `pnpm check:changesets`: passes; changeset
`fix-dashboard-remount-churn` (`@runfusion/fusion` patch, labeled
format).
- Known pre-existing failures NOT caused by this branch (verified
failing at base a224c1111 in a clean worktree): 7 tests in
`TaskDetailModal.oversight-controls/oversight-mobile/models-progress-workflow`.
- jsdom cannot prove rendered-grid correctness for xterm reveal; per the
plan's risk note, manual browser verification of terminal reveal remains
recommended.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* Switching views or tabs no longer resets Planning Mode, task details,
terminals, planner chats, or popped-out task windows.
  * Streaming content remains expanded and stable as new entries arrive.
* Hidden views suspend background activity and resume correctly when
shown.
  * Terminal sessions reconnect automatically when needed.

* **Improvements**
  * Command Center and Dev Server selections persist per project.
  * Custom Dev Server commands are preserved while browsing suggestions.
* Improved stability when reordering task lists and updating server
states.

* **Documentation**
* Updated dashboard guidance for hidden, retained task pop-ups and view
transitions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-30 21:50:47 -07:00

701 lines
17 KiB
CSS

/* === Split Project Button === */
/* === Project Selector === */
.project-selector {
position: relative;
display: inline-flex;
align-items: center;
gap: var(--space-xs);
margin-top: var(--space-xs);
overflow: visible;
min-width: 0;
max-width: min(32ch, 24vw);
}
.project-selector-trigger,
.project-selector__trigger {
display: inline-flex;
align-items: center;
gap: var(--space-xs);
justify-content: center;
min-width: 0;
max-width: 100%;
padding: calc(var(--space-xs) + var(--space-xs) / 2) calc(var(--space-xs) + var(--space-xs) / 2);
background: transparent;
border: 1px solid var(--border);
border-radius: var(--radius-md);
color: var(--text-muted);
cursor: pointer;
transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.project-selector-trigger-label,
.project-selector__trigger-text {
min-width: 0;
max-width: min(24ch, 18vw);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: var(--text);
font-size: 13px;
line-height: 1;
}
.project-selector-trigger:hover,
.project-selector__trigger:hover {
background: var(--card-hover);
color: var(--text);
border-color: var(--text-dim);
}
.project-selector-trigger--open,
.project-selector__trigger.open {
color: var(--text);
border-color: var(--text-dim);
}
.project-selector-chevron,
.project-selector__trigger-chevron {
transition: transform var(--transition-fast);
}
.project-selector-chevron--open,
.project-selector__trigger-chevron.rotate {
transform: rotate(180deg);
}
.project-selector-dropdown,
.project-selector__dropdown {
position: absolute;
top: calc(100% + 8px);
left: 0;
z-index: 100;
min-width: 240px;
max-width: 360px;
max-height: min(480px, calc(100vh - 120px));
overflow-y: auto;
overscroll-behavior: contain;
padding: var(--space-sm);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
background: var(--surface);
box-shadow: var(--shadow-lg);
scrollbar-width: thin;
scrollbar-color: var(--text-dim) transparent;
}
.project-selector__dropdown::-webkit-scrollbar {
width: 6px;
}
.project-selector__dropdown::-webkit-scrollbar-track {
background: transparent;
}
.project-selector__dropdown::-webkit-scrollbar-thumb {
background-color: var(--text-dim);
border-radius: 3px;
}
.project-selector-item,
.project-selector__item {
width: 100%;
display: flex;
align-items: center;
gap: var(--space-sm);
padding: 8px 10px;
background: transparent;
border: none;
border-radius: var(--radius-md);
color: var(--text);
font-size: 13px;
cursor: pointer;
text-align: left;
transition: background var(--transition-fast);
}
.project-selector-item:hover,
.project-selector__item:hover,
.project-selector__item.highlighted {
background: var(--card-hover);
}
.project-selector-item--current,
.project-selector__item[aria-selected="true"] {
background: var(--card-hover);
}
.project-selector-divider {
height: 1px;
margin: var(--space-xs) var(--space-sm);
background: var(--border);
}
.project-selector-manage {
width: 100%;
display: flex;
align-items: center;
justify-content: flex-start;
padding: var(--space-sm) calc(var(--space-sm) + var(--space-xs));
background: transparent;
border: none;
border-radius: var(--radius-md);
color: var(--text);
font-size: 13px;
cursor: pointer;
text-align: left;
transition: background var(--transition-fast);
}
.project-selector-manage:hover {
background: var(--card-hover);
}
.project-selector-manage:focus-visible {
outline: none;
box-shadow: var(--focus-ring-strong);
}
.project-selector__trigger-icon {
flex-shrink: 0;
}
.project-selector__search {
display: flex;
align-items: center;
gap: var(--space-xs);
padding: var(--space-xs) var(--space-sm);
margin-bottom: var(--space-xs);
border: 1px solid var(--border);
border-radius: var(--radius-md);
}
.project-selector__search-icon {
color: var(--text-dim);
flex-shrink: 0;
}
.project-selector__search-input {
flex: 1;
min-width: 0;
border: none;
background: transparent;
color: var(--text);
font-size: 13px;
}
.project-selector__search-input:focus-visible {
outline: none;
}
.project-selector__search-clear {
border: none;
background: transparent;
color: var(--text-muted);
cursor: pointer;
display: inline-flex;
align-items: center;
justify-content: center;
}
.project-selector__section {
display: flex;
flex-direction: column;
gap: 2px;
}
.project-selector__section + .project-selector__section {
margin-top: var(--space-xs);
}
.project-selector__section-header {
display: flex;
align-items: center;
gap: var(--space-xs);
padding: var(--space-xs) calc(var(--space-sm) + var(--space-xs));
color: var(--text-dim);
font-size: calc(var(--space-sm) + var(--space-xs) * 0.75);
}
.project-selector__no-results {
display: flex;
align-items: center;
gap: var(--space-xs);
padding: var(--space-sm) calc(var(--space-sm) + var(--space-xs));
color: var(--text-muted);
font-size: 13px;
}
.project-selector__no-results-icon {
flex-shrink: 0;
opacity: 0.5;
}
/* Autocomplete highlight — marks the matched text substring */
.project-selector__highlight {
background: transparent;
color: inherit;
font-weight: 700;
text-decoration: underline;
text-decoration-color: var(--todo);
text-underline-offset: 2px;
text-decoration-thickness: 2px;
}
/* Exact match indicator banner */
.project-selector__exact-match {
padding: var(--space-xs) calc(var(--space-sm) + var(--space-xs));
margin-bottom: var(--space-xs);
font-size: 12px;
color: var(--todo);
background: color-mix(in srgb, var(--todo) 8%, transparent);
border-radius: var(--radius-md);
text-align: center;
}
/* Exact match badge shown on item */
.project-selector__exact-badge {
font-size: 10px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
padding: 1px 5px;
border-radius: var(--radius-sm);
background: color-mix(in srgb, var(--todo) 15%, transparent);
color: var(--todo);
flex-shrink: 0;
}
/* Exact match item subtle highlight */
.project-selector__item.exact-match {
background: color-mix(in srgb, var(--todo) 5%, transparent);
}
.project-selector__footer {
margin-top: var(--space-xs);
padding-top: var(--space-xs);
border-top: 1px solid var(--border);
}
.project-selector__view-all {
width: 100%;
display: flex;
align-items: center;
gap: var(--space-sm);
justify-content: flex-start;
padding: var(--space-sm) calc(var(--space-sm) + var(--space-xs));
background: transparent;
border: none;
border-radius: var(--radius-md);
color: var(--text);
font-size: 13px;
cursor: pointer;
}
.project-selector__view-all:hover,
.project-selector__view-all.highlighted {
background: var(--card-hover);
}
.project-selector__view-all:focus-visible {
outline: none;
box-shadow: var(--focus-ring-strong);
}
.project-selector-dot,
.project-selector__dot,
.project-selector__item-check {
flex-shrink: 0;
}
.project-selector-dot,
.project-selector__dot {
width: 8px;
height: 8px;
border-radius: 50%;
}
.project-selector-info,
.project-selector__item-info {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 2px;
}
.project-selector-name,
.project-selector__item-name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-weight: 500;
}
.project-selector-path,
.project-selector__item-path {
font-size: calc(var(--space-sm) + var(--space-xs) * 0.75);
color: var(--text-muted);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.project-selector-check,
.project-selector__item-check {
color: var(--todo);
}
/* Bookmark star toggle */
.project-selector__bookmark {
flex-shrink: 0;
display: inline-flex;
align-items: center;
justify-content: center;
padding: 2px;
background: transparent;
border: none;
border-radius: var(--radius-sm);
color: var(--text-dim);
cursor: pointer;
user-select: none;
opacity: 0;
transition: opacity var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}
/* Show star on row hover or when bookmarked */
.project-selector__item:hover .project-selector__bookmark,
.project-selector__item.highlighted .project-selector__bookmark,
.project-selector__bookmark.bookmarked {
opacity: 1;
}
.project-selector__bookmark:hover {
color: var(--todo);
background: var(--card-hover);
}
.project-selector__bookmark.bookmarked {
color: var(--todo);
}
.project-selector__bookmark:focus-visible {
outline: none;
box-shadow: var(--focus-ring-strong);
}
/* Light theme overrides for project selector */
[data-theme="light"] .project-selector-trigger:hover {
background: var(--card-hover);
}
[data-theme="light"] .project-selector-dropdown {
background: var(--surface);
}
[data-theme="light"] .project-selector-item:hover {
background: var(--card-hover);
}
[data-theme="light"] .project-selector-item--current,
[data-theme="light"] .project-selector__item[aria-selected="true"] {
background: color-mix(in srgb, var(--todo) 10%, transparent);
}
/* === Mobile Project Switch (logo-adjacent dropdown) === */
.mobile-project-switch {
position: relative;
display: none; /* Hidden by default, shown on mobile via media query */
}
.mobile-project-switch-trigger {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 36px;
min-height: 36px;
padding: 6px;
background: transparent;
border: none;
border-radius: var(--radius-md);
color: var(--text-muted);
cursor: pointer;
transition: background var(--transition-fast), color var(--transition-fast);
}
.mobile-project-switch-trigger:hover {
background: var(--card-hover);
color: var(--text);
}
.project-selector-trigger:focus-visible,
.project-selector__trigger:focus-visible,
.project-selector-item:focus-visible,
.project-selector__item:focus-visible,
.mobile-project-switch-trigger:focus-visible,
.mobile-project-switch-item:focus-visible {
outline: none;
box-shadow: var(--focus-ring-strong);
}
.mobile-project-switch-trigger--open {
color: var(--todo);
background: var(--card-hover);
}
.mobile-project-switch-chevron {
transition: transform var(--transition-fast);
}
.mobile-project-switch-chevron--open {
transform: rotate(180deg);
}
.mobile-project-switch-dropdown {
position: absolute;
top: calc(100% + 4px);
left: 0;
z-index: 100;
min-width: 200px;
max-width: 280px;
padding: var(--space-xs);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
background: var(--surface);
box-shadow: var(--shadow-lg);
}
.mobile-project-switch-item {
width: 100%;
display: flex;
align-items: center;
gap: var(--space-sm);
padding: 10px 12px;
background: transparent;
border: none;
border-radius: var(--radius-md);
color: var(--text);
font-size: 13px;
cursor: pointer;
text-align: left;
transition: background var(--transition-fast);
}
.mobile-project-switch-item:hover {
background: var(--card-hover);
}
.mobile-project-switch-item--current {
background: var(--card-hover);
}
.mobile-project-switch-dot {
flex-shrink: 0;
width: 8px;
height: 8px;
border-radius: 50%;
}
.mobile-project-switch-info {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 2px;
}
.mobile-project-switch-name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-weight: 500;
}
.mobile-project-switch-path {
font-size: calc(var(--space-sm) + var(--space-xs) * 0.75);
color: var(--text-muted);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.mobile-project-switch-check {
flex-shrink: 0;
color: var(--todo);
}
.mobile-project-switch-divider {
height: 1px;
margin: var(--space-xs) 0;
background: var(--border);
}
.mobile-project-switch-section-label {
padding: var(--space-xs) var(--space-sm);
color: var(--text-muted);
font-family: var(--font-primary);
font-size: var(--font-size-xs);
font-weight: 500;
}
.mobile-project-switch-bookmark {
display: inline-flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
padding: var(--space-xs);
border-radius: var(--radius-md);
color: var(--text-muted);
cursor: pointer;
transition: color var(--transition-fast), background var(--transition-fast);
}
.mobile-project-switch-bookmark:hover,
.mobile-project-switch-bookmark.bookmarked {
color: var(--accent);
}
.mobile-project-switch-bookmark:hover {
background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.mobile-project-switch-bookmark:focus-visible {
outline: none;
box-shadow: var(--focus-ring-strong);
}
.mobile-project-switch-manage {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
gap: var(--space-sm);
padding: var(--space-sm) calc(var(--space-sm) + var(--space-xs));
background: transparent;
border: none;
border-radius: var(--radius-md);
color: var(--text-muted);
font-size: calc(var(--space-sm) + var(--space-xs) * 1.25);
cursor: pointer;
text-align: center;
transition: background var(--transition-fast), color var(--transition-fast);
}
.mobile-project-switch-manage:hover {
background: var(--card-hover);
color: var(--text);
}
.mobile-project-switch-manage:focus-visible {
outline: none;
box-shadow: var(--focus-ring-strong);
}
/* Compact styles for mobile-project-switch (mobile + tablet) */
@media (max-width: 768px), (min-width: 769px) and (max-width: 1024px) {
.mobile-project-switch {
display: inline-flex;
align-items: center;
}
}
@media (max-width: 768px) {
.mobile-project-switch-bookmark {
padding: var(--space-sm);
}
}
/* === Project Content Wrapper (footer-safe layout) === */
.dashboard-project-stack {
display: flex;
flex: 1;
flex-direction: column;
min-height: 0;
min-width: 0;
width: 100%;
}
.dashboard-project-shell {
/*
FNXC:DashboardFooterLayout 2026-06-21-10:30:
Keep the desktop footer-height token on the project shell for sibling consumers such as the left sidebar, which cannot inherit custom properties from project-content itself.
FNXC:TerminalLayout 2026-07-04-19:26:
The optional pinned terminal sits below this shell inside .dashboard-project-stack, so this flex row must keep min-height:0 and relinquish vertical space instead of being covered by an overlay.
*/
--executor-footer-height: 36px;
display: flex;
flex: 1;
min-height: 0;
min-width: 0;
width: 100%;
/*
FNXC:Navigation 2026-06-22-00:10:
Anchor for the right dock, which is absolutely positioned so it overlays the page content instead of shrinking it.
*/
position: relative;
}
.dashboard-project-shell--with-sidebar {
align-items: stretch;
overflow: hidden;
}
.project-content {
display: flex;
flex: 1;
min-height: 0;
min-width: 0;
width: 100%;
overflow: hidden;
/*
FNXC:PlanningKeepAlive 2026-07-22-12:30:
Containing block for kept-alive main views (KeepAliveView): their hidden state is position:absolute inset:0 so a hidden Planning subtree consumes no layout space while keeping a real (non-zero) box for xterm-safe geometry.
*/
position: relative;
}
/**
* Wrapper for project-view content (board, list, agents) that reserves space
* for the fixed ExecutorStatusBar footer. This wrapper is the single source of
* truth for the footer-safe content area — child views simply use height: 100%
* to fill the available space without needing to know about the footer.
*
* When the footer is present, --with-footer reserves space via padding-bottom
* equal to the footer height. Because the wrapper uses box-sizing: border-box,
* children with height: 100% resolve to the content area (wrapper height minus
* padding), which is exactly the safe zone above the fixed footer.
*
* On mobile the token is overridden to match the shorter touch-safe footer.
*/
.project-content--with-footer {
/*
FNXC:DashboardFooterLayout 2026-06-21-10:30:
The desktop footer wrapper must co-locate --executor-footer-height: 36px with its padding-bottom consumer so the footer-safe contract and CSS regression tests stay in sync.
*/
--executor-footer-height: 36px;
padding-bottom: var(--executor-footer-height);
}
@media (max-width: 768px) {
.dashboard-project-shell {
display: flex;
flex: 1;
min-height: 0;
min-width: 0;
}
.project-content--with-footer {
/*
FNXC:DashboardFooterLayout 2026-06-21-10:30:
ProjectSelector.css loads after ExecutorStatusBar.css in concatenated CSS fixtures, so repeat the mobile footer-height override here to preserve the touch-safe footer reservation when the desktop wrapper token is co-located with its consumer.
*/
--executor-footer-height: calc(var(--space-lg) * 2 + var(--space-xs));
}
/* Hide project selector on mobile (belt-and-suspenders with conditional rendering) */
.project-selector {
display: none;
}
}