Repository navigation
feat(app): fold long user messages - #59435
Conversation
There was a problem hiding this comment.
Looks sound from reading the code. I couldn't run it: Playwright's Chromium won't start in my environment because a system library is missing, so the e2e spec didn't run. tsc passes for packages/app and packages/session-ui.
The fold is laid out whole and clipped, so copy and select-all still get the full text. The open state lives in the timeline's disclosure store, so it survives row recycling. The scroll correction on collapse shouldn't clash with the virtualizer's own adjustment, which only applies to rows before the rendered range.
Public API is unchanged. The two new i18n keys are English-only and fall back to English in other locales.
This is a visible web UI change and I couldn't capture it, so before/after screenshots or a short clip of folding and unfolding a long prompt would help.
6ef5400 to
0078e06
Compare
There was a problem hiding this comment.
I re-checked the new commit by reading it and running tsc (clean in packages/session-ui and packages/app). I still couldn't run the web UI or the e2e spec here because Playwright's browser fails to start. No earlier threads were open, and the public API is unchanged.
The follow-ups look right. Long messages now fold on first render, measuring is skipped while the timeline is detached, and the max-height uses 8lh. The collapse correction only runs when the message's top is above the screen, and unpin only happens on open. In Find, the toggle label is skipped and a match hidden in the fold opens the message. Opening clears the folded state, so the retry can't loop.
One thing worth doing: the fold e2e test is now about 150 lines in one block, covering edge cases, selection, the detached-tab case, opening, remount, closing and Find. The detached-tab step removes and re-inserts the bubble by hand, which doesn't match how a cached tab is really hidden. Could you trim it to the core fold/open/Find checks, or split it into a few smaller tests, so a failure points at one behaviour?
0078e06 to
189372b
Compare
189372b to
bdc61b4
Compare
Long messages you sent now fold to their first 8 lines in the timeline, with a Read more button to open them.
A pasted log or a long dictated prompt no longer fills the screen every time you scroll past it. It's the same rule the iOS app uses. Short messages and replies don't change.
💡 Why
You know what you said. A 40-line paste between two short replies makes the thread hard to scan.
🆕 Now you can
📊 Proof
The new e2e test checks that 12 lines stay open and 13 fold to 8, that the whole text stays selectable, that opening keeps the top in place and the row height updates, and that an opened message is still open after scrolling far enough to unmount it and back. It fails without the change, since there's no button. 6 of 6 passed (3 repeats each, with the neighbouring diff-anchor test).
👀 Read:
UserMessageFoldinmessage-content.tsx. It measures the text's own height to count lines, and closing a message taller than the screen scrolls by the amount the button moved, so the button stays under the pointer. Opening and closing also stop the timeline following its end, so an opened message near the bottom doesn't scroll its top away. Find skips the Read more button and opens a folded message when a match is hidden in it. A message in a hidden, cached tab keeps its fold instead of measuring 0 lines. The existing diff-anchor test used a long user message for overflow, so that filler is now assistant text. The rest is routine.Visual
Picked from four prototyped options · no user reports · stills from the components lab story, rendered headless
Checks run
bun typecheckinpackages/session-uiandpackages/app: no errorsbun run typecheck:e2e: no new errors (the existing ones are unchanged)bun run testinpackages/session-ui: 327 pass;packages/appsrc/sessionunit tests: 122 passbun run test:e2e:built -- e2e/regression/timeline-geometry.spec.ts -g "folds a prompt|keeps a file diff anchored" --retries=0 --repeat-each=3: 6 passedFolding is behind Settings → Experimental → Fold long messages, off by default. With it off, user messages render as on
dev(no fold DOM, no measuring).