Skip to content

fix(sidebar): stop the session list collapsing and re-expanding on first load - #20520

Merged
iamwhatever merged 1 commit into
mainfrom
fix/remote-crew-session-flash
Oct 16, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
fix/remote-crew-session-flash

Conversation

@kyleseaman

@kyleseaman kyleseaman commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The session list paints once, in its final layout, when it first loads, instead of collapsing and springing back open.

When the dashboard's session list first appears, its rows snap into a squashed, overlapping stack and then spring back into place over about 300 ms. It happens on every load. A remote crew makes it obvious: the crew's pane is already on screen while the list is still loading over the tunnel, so the reads land far apart and every one of them moves the rows.

Why it matters

Every user sees the list flash on load, and anyone opening a remote crew sees it worst. It reads as a broken, glitchy list at the exact moment the user is trying to pick a session.

Not a goal

  • Changing how rows animate after the list has loaded. A session created while the list is on screen still slides in, and folder moves still animate.
  • Reducing how many times the sidebar re-renders while it loads.
  • Changing the remote-crew tunnel or how fast its reads arrive.

What changed (motivation → approach → change)

The list flashed because each session row animates any change in its position, and the first moments of a fresh list are full of position changes that are not movement. Rows first lay out at a 60 px placeholder height (content-visibility: auto) and then at their real height, and the folder, tag-column and session reads each land a moment apart and refile rows. Each of those layout changes was animated, and every row also played its mount slide-in, so the list collapsed and re-expanded while loading.

While the list's first population settles, rows now snap to each new layout instead of springing, and skip their slide-in. They keep their layout animation from the moment they mount, because Framer reads a row's layout and layoutId only once, at mount; only the layout transition is made instant ({ type: false }, the same path Framer uses for reduced motion). The hold ends once the session, folder and tag-column reads have settled and the rows have painted once. There is no time limit, so a slow remote crew is never handed back to animation halfway through its load. A gateway with no sessions counts as settled as soon as any session list has arrived since the page loaded (slotsGeneration). After that, rows animate exactly as before.

The hook is website/src/pages/chat-sidebar/rowAnimSettle.ts; ChatSidebar.tsx computes the hold and puts it on the shell scope as rowMotionHeld (chat-sidebar/scope.ts), chat-sidebar/laneRows.tsx passes it into each row's placement through rows.ts, and SessionRow.tsx applies it. The sidebar root carries data-row-anim="holding" or "settled", which the test helper settleSidebarRowAnim() in website/src/test/helpers.tsx waits on. docs/feature-map/README.md and the sidebar owner table in docs/system-specs/modules/history.md list the helper.

Backwards compatibility

Compatible: only how rows move during the first load changes; no API, stored data or prop contract changes.

Removes nothing: rows still spring on reorders and slide in when they appear after load; only the animation of the first load's layout changes is skipped.

Tests

  • website/src/pages/chat-sidebar/rowAnimSettle.test.ts (new): the hook holds while reads are outstanding, settles two frames after they settle (not on the same commit), stays settled if a read later goes back to unsettled (a reconnect), and keeps holding for as long as a slow read takes (60 s) before settling on it.
  • ChatSidebar.animCap.test.tsx: rows mount with their layout projection (layout, layoutId, the lane's layoutScroll) while the list is holding, with an instant layout transition and no slide-in, and the same elements switch to the spring once it settles; an empty gateway whose session list already arrived settles; the list holds while no session list has arrived and settles when one does. Its Framer mock records the props each element mounted with and keeps one component per tag, as the real motion.div does.
  • Existing sidebar tests that assert row animation wait for the list to settle with settleSidebarRowAnim() (animCap, boardDuplicate, selectorScope, staticRows, stickyFolderCollapse, ChatSidebarMoreCoverage); two setups also set slotsLoaded: true. ChatSidebar.ownerComposition.test.ts pins the hook in the sidebar's owner-composition list.

Determinism: the ten changed or affected test files passed five shuffled runs (--sequence.shuffle, seeds 2101/2238/2375/2512/2649, 253/253 each). settleSidebarRowAnim() waits up to 5 s rather than waitFor's 1 s default: with six copies of ChatSidebar.animCap.test.tsx running at once, the 1 s budget failed 4 of 6 runs and 5 s passed 6 of 6. It is an event wait, so a passing run does not get slower.

Manual verification

Reproduced on an isolated dev gateway with the dashboard inside an iframe (as a remote crew's pane is) and added delay on every API call, recorded frame by frame at the same viewport on main and on this branch. With 300 ms per call, main's rows moved for about 500 ms after first paint; this branch's did not move. With 2.5 s per call, well past any short cap, this branch's list still painted once and held still. Not reproduced over a real remote-crew tunnel; the iframe-plus-delay setup produces the same sequence of layout changes.

Screenshots / video

Before (main, 300 ms per call): rows collapse into an overlapping stack, then spring open.

After (this branch, 300 ms per call): the list paints once and stays put.

After (this branch, 2.5 s per call): a slow load still paints once.

Frame strip: the first frames with the list on screen

Before and after frame strip

Related Issues

No linked issue: a direct fix requested by a maintainer, with no tracking issue filed.

Pattern harvest

Rule candidate: review-prompt
Pattern: layout/mount animation left enabled during a list's initial population, so placeholder-to-real sizing and staggered data reads are animated as if they were movement.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@kyleseaman
kyleseaman requested review from a team and KiroCrewCaptain as code owners October 14, 2026 22:16
@kyleseaman
kyleseaman requested a review from bolichen97 October 14, 2026 22:16
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 14, 2026
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of fe997023d10b2aa0f74e8b6bb3c7418ae24729d3 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Rows that mount during the hold are never animated. A session created while a slow remote crew is still loading gets no slide-in; confirm that is acceptable.

[DESIGN-REVIEWED] fe99702

Description read

[DESCRIPTION-READ] 43c3efe83dc698948203dda0f7422aa1951403c56890ae82c1f6ae87716baced

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of fe997023d10b2aa0f74e8b6bb3c7418ae24729d3 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: PASS

Watch the 2.5 s/call GIF to confirm the list paints once and stays still while the slow reads arrive.

[UX-REVIEWED] fe99702

Description read

[DESCRIPTION-READ] 6932bb88072ac89ce030de011dbf2f162106a2307368f6503f37a16d1548698d

That sha256 names everything this verdict read: the PR description, plus the 7 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of fe997023d10b2aa0f74e8b6bb3c7418ae24729d3 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] fe99702

False positive or not applicable? A repository writer can comment:
/ai-review override gpt fe997023d10b2aa0f74e8b6bb3c7418ae24729d3: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed fe997023d10b2aa0f74e8b6bb3c7418ae24729d3 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] fe99702

Verdict parsed from the review's SHA-scoped output markers for commit fe997023d10b2aa0f74e8b6bb3c7418ae24729d3.

False positive or not applicable? A repository writer can comment:
/ai-review override fable fe997023d10b2aa0f74e8b6bb3c7418ae24729d3: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of fe997023d10b2aa0f74e8b6bb3c7418ae24729d3 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Check that every load path eventually settles. rowMotionHeld never times out, so an input stuck at false keeps the hold on and new sessions never slide in.

What this change ships

Inventory (6 items) — 6 justified

Intent: the session list should paint once in its final layout on first load, without collapsing and springing back open. FIX.

  1. While the list first loads, rows snap to each new layout instead of springing — justified
  2. While the list first loads, rows skip their mount slide-in — justified
  3. The hold has no time limit, so a slow remote crew stays held until its reads settle — justified
  4. An empty gateway counts as settled once any slot list has arrived (slotsGeneration) — justified
  5. The sidebar root shows data-row-anim="holding"/"settled"; only the test helper reads it — justified
  6. Test helper settleSidebarRowAnim() added, with a 5 s wait; existing sidebar tests now wait on it — justified

[FIRST-PRINCIPLES-REVIEWED] fe99702

Description read

[DESCRIPTION-READ] 95e14aac0870134383f069e947c2b56e797aca24d23d7a6ca304529df0d99ef1

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 14, 2026
@kyleseaman
kyleseaman force-pushed the fix/remote-crew-session-flash branch from 36592e8 to 69a7868 Compare October 15, 2026 00:08
@kyleseaman

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: 2 s settle cap counted from mount

  • span=4dee61b3d87a — The cap starts timing at mount, not at first paint

fixed in 69a7868: the time cap is removed, so a slow read is never cut off and the list is never handed back to animation mid-load.
A slow first read and a missing one cannot be told apart by row count (rows only enter with an applied slot list), so the cap is not narrowed but subtracted.
The case the cap stood in for (an empty gateway: sseConnected resets slotsLoaded, sseSlots ignores empty frames) now settles on slotsGeneration > 0, which counts slot lists applied since page load and is never reset.
Folders and tag columns settle on success or error under a finite retry policy, so they need no cap.
Clears-when evidence: a frame-by-frame recording at 2.5 s delay per API call shows the list painting once and holding still (after-slow.gif in the description).

@kyleseaman

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: settle hold gated layout/layoutId/layoutScroll off during first load

  • span=63c73dc89e22 — rows mounted during the hold never get layout projection

fixed in 69a7868: the settle hold no longer touches layout, layoutId or layoutScroll; rowAnimEnabled is back to main's definition, so every row and lane mounts projected.
Verified against framer-motion 12.40.0: createProjectionNode copies those props once at node creation, and motion-dom's mount/willUpdate skip layout work when they are unset.
The hold now rides on a separate rowMotionHeld flag: transition.layout = { type: false } (read per layout change via getDefaultTransition(), the reduced-motion path) and initial={false}.
ChatSidebar.animCap.test.tsx pins that rows mount with layout/layoutId while holding and the same elements switch to the spring after settle.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 15, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

Holding 69a7868 only because the three current-head lane punchlines have no reply. The fix looks sound.

The hold latches once (

const [settled, setSettled] = useState(false)
useEffect(() => {
if (settled || !readsSettled) return
let inner = 0
const outer = requestAnimationFrame(() => { inner = requestAnimationFrame(() => setSettled(true)) })
return () => {
cancelAnimationFrame(outer)
cancelAnimationFrame(inner)
}
}, [readsSettled, settled])
return settled
}
). It gates only the mount slide-in and the layout transition (
initial={rowAnimEnabled && !rowMotionHeld ? { opacity: 0, x: -12 } : false}
,
transition={{ layout: rowMotionHeld ? { type: false } : { type: 'spring', stiffness: 500, damping: 35 }, opacity: { duration: 0.2 }, x: { duration: 0.2 } }}>
), so layout/layoutId are still set at mount. Its inputs all settle on their own (
const slotListLanded = useAppSelector(s => (s.dashboard.slotsGeneration ?? 0) > 0)
const rowAnimSettled = useRowAnimSettled((slotsLoaded || slotListLanded) && (foldersLoaded || foldersFailed) && tagColumnsSettled)
). Your earlier dispositions for 36592e8 match this diff. CI is green.

To clear, post a reply for this head to each of:

  1. Design: rows that mount after settle still slide in. From the code they do, since the hook never resets within a mount; please confirm on the PR.
  2. UX: confirm from the GIFs that the list holds still after first paint.
  3. First Principles: the real remote-crew tunnel check, or state that the iframe-plus-delay repro stands in for it. The description already says it was not reproduced over a real tunnel.

A new push needs a fresh review.

— crew-pr-reviewer (r102)

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 15, 2026
@kyleseaman
kyleseaman force-pushed the fix/remote-crew-session-flash branch from 69a7868 to f459c64 Compare October 15, 2026 19:01
@kyleseaman

Copy link
Copy Markdown
Contributor Author

Rebased: 69a7868bf6 -> f459c64a0c, onto main 6d4f2874e8. Main's #20524 moved ChatSidebar's row builder into chat-sidebar/laneRows.tsx, so rowMotionHeld now reaches each row through SidebarScope (chat-sidebar/scope.ts) and laneRows.tsx; the fix's logic is unchanged. #20749 added connected to the same destructuring line, and both are kept. Checked locally: tsc, eslint, the changed tests shuffled, the feature-map gate and docs-lint, plus tsc and the related sidebar tests on a trial merge with the current main 8da5b41552.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 15, 2026
@kyleseaman

Copy link
Copy Markdown
Contributor Author

Main is red, not this PR: Backend Tests shard 6 (Linux and Windows), and Coverage Gate after it, fail on test/test_dashboard_server_composition_contract.py::test_the_lazy_imports_stay_inside_the_functions_that_need_them (assert 84 == 83). Main's own CI run fails the same way on 8da5b41552 (run 38788179413), and this PR changes no Python. The fix is in flight in #20930 / #20928. This PR is waiting for that fix to land on main, then it will be rebased onto it and CI re-run.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 16, 2026
@kyleseaman
kyleseaman force-pushed the fix/remote-crew-session-flash branch from f459c64 to fe99702 Compare October 16, 2026 12:52
@kyleseaman

Copy link
Copy Markdown
Contributor Author

Rebased onto main 12835a8 to clear the conflict in docs/feature-map/README.md: kept main's Sessions row and re-added this PR's one rowAnimSettle.ts mention. The website patch is line-for-line unchanged from f459c64. tsc, eslint, the sidebar tests (the known createMenu load flake aside, which passes alone), the feature-map gate and docs-lint pass locally.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 16, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at fe99702, only for unanswered review items. The code still looks sound to me.

The hold latches once and never resets within a mount (rowAnimSettle.ts#L32-L44). It only drops the mount slide-in and makes the layout transition instant, so layout/layoutId are still set at mount (SessionRow.tsx#L1060-L1069). Each input settles on its own terminal state (ChatSidebar.tsx#L586-L587). CI is green.

These three lane items on this head have no reply yet. They are the same asks from r102, carried through the rebases:

  1. Design: a session created while a slow remote crew is still loading mounts during the hold and gets no slide-in. Please confirm on the PR that this is intended.
  2. UX: please confirm from the 2.5 s/call GIF that the list holds still after first paint.
  3. First Principles: please confirm that every load path settles, or name an input that can stay unsettled. As far as I can see, all three inputs settle.

One disposition per lane for this head clears this. A new push needs a fresh review.

— crew-pr-reviewer (r107)

@iamwhatever
iamwhatever merged commit 7b01caf into main Oct 16, 2026
102 checks passed
@iamwhatever
iamwhatever deleted the fix/remote-crew-session-flash branch October 16, 2026 18:06
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 16, 2026
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