Repository navigation
Collapse mobile follow-up composer after submit - #1381
Conversation
|
🚨 SLOP COP 🚨 · I am SlopCop. I am now reviewing this change for security, code quality, performance, architecture, and product behavior. |
SawyerHood
left a comment
There was a problem hiding this comment.
🚨 SLOP COP 🚨 · review
ELI5
This change makes the small phone message box close after you send a message.
It is like closing a toy box after you use it.
The touch path works.
A tablet keyboard can also close the box, which makes the next message harder.
Review
I found one behavior concern and one test gap.
-
Medium — hardware keyboard focus regression. The gate uses the device class, not the submit origin. Command+Enter only comes from a hardware keyboard. Primary Enter on a coarse-pointer iPad also identifies hardware Enter. Both paths now blur and collapse the composer. The user must tap before the next message. Blur only after a pointer submit, or confirm this behavior and add coverage.
-
Medium — the mobile test skips the mobile viewport branch. jsdom has no
window.visualViewport. The new test therefore collapses immediately. A phone waits for viewport growth or the 750 ms fallback. StubvisualViewport, then test the resize and fallback paths.
I found no security issue. The change adds no network, permission, data, or server contract surface.
I found no render or compute cost in the touch path. The new value is a boolean, and it only changes two callback dependencies.
The change reuses the existing blurPromptEditor helper. I found no project-wide duplicate implementation. The wrapper repeats coarse-pointer and compact state that the inner component already knows. Submit origin is the more important contract.
Validation
- The two focused test files passed: 111 tests.
- The app type check passed.
- The app lint task passed. It reported 148 warnings outside the changed files.
- A local Chromium test used a 390 by 844 viewport and a coarse pointer.
- The touch submit cleared the draft, moved focus to the body, and collapsed the composer.
- I did not test a physical iPad or a Magic Keyboard.
I posted a comment-only review. I did not approve the pull request or request changes.
…routes, composer retention (E1, E6, E7, E10, D3, J3, J4, I6, B28) (#1900) ## What was wrong On phones (iOS Safari, compact viewports) several app-side patterns made every page and every thread heavier than it needed to be: - Sidebar rows wrapped each row in a modal Radix ContextMenu whose 700 ms long-press set aria-hidden on #root, registered a non-passive touchmove and flipped body pointer-events with the timeline mounted behind the drawer (E1). - dnd-kit's TouchSensor kept a permanent non-passive window touchmove listener from sidebar DndContexts mounted at boot, and the SidebarInset swipe-open registered another one for every content touch. Both make the first move of every scroll wait for the main thread (E6, E7). - Settings/Tools routes swapped the whole AppSidebar out; returning remounted ProjectList in the closed drawer (E10). - A pending permission/question swapped FollowUpPromptBox out of the tree, rebuilding TipTap per approval (D3). - The collapsed compact composer built the full TipTap editor during thread mount (D5 (reverted, see below)). - Fixed-panel storage was scanned and zod-parsed on every navigation and re-written on mount (J3). - Heavy per-thread caches used the default 5-minute gcTime (J4). - PR check icons and the GitHub logo fetched light+dark PNGs from github.githubassets.com (I6). - Root compose showed only "Loading…" until the sidebar bootstrap settled (B28). ## What changed - E1: `CompactLongPressMenu` (long-press/right-click detector, nothing mounted until first open) opens the existing responsive drawer with the same DropdownMenu items; desktop keeps the context menu. - E6: `SidebarTouchSensor` installs dnd-kit's listener only while the compact drawer shows (external store written by SidebarProvider, no context subscription); tab strip wires TouchSensor only when open with 2+ tabs. - E7: only edge-zone touches (24-72 px) get the non-passive swipe path; deeper touches keep the recognizer on a passive listener without preventDefault. - E10: on compact one persistent `<Sidebar>` panel hosts the AppSidebar body (hidden while Settings/Tools body shows); `mobileHosted` mode on AppSidebar/SectionSidebar; 220 ms close hold preserved. - D3: `pendingInteraction` prop on FollowUpPromptBox keeps the editor shell mounted and hidden, interaction as last stack item, footer pickers read-only. - D5 (reverted, see below): static 48 px compact row on compact + coarse pointer; editor realizes after paint (idle/timeout, transition) or at first tap (pointerdown mounts under an overlay, click focuses via `focusEndForTap`); Stop/voice/drafted submit work from the row; #1771 handoff untouched. - J3: prune once per page load from idle, lastUsedAt checked before schema parse, no-op storage writes skipped. - J4: `HEAVY_PAYLOAD_QUERY_POLICY` (60 s gc) on turn-summary details and file previews; diff patches use a reader lease with a 60 s post-unmount eviction (observer-less entries no longer gc while shown). - I6: bundled GitHub glyph + theme-token status dot; logo via the shared icon. - B28: composer renders immediately with a loading project picker; projectId-keyed queries gate on the settled bootstrap. ## How you verified - `pnpm exec turbo run typecheck --filter=@bb/app`: pass. - `pnpm exec turbo run lint --filter=@bb/app`: 0 errors (147 pre-existing warnings, unchanged count). - `pnpm exec turbo run test --filter=@bb/app --force`: 364 files, 2906 passed, 3 skipped (one registry boundary test fixed in the last commit and re-run green). - New/updated tests: compact-long-press-menu.test.tsx, useSidebarReorderDnd.test.tsx (sensor install/remove), sidebar.test.tsx (passive vs non-passive registration), AppLayoutSidebar.test.tsx (single panel + single mount across app -> settings -> tools -> app), FollowUpPromptBox.test.tsx (editor DOM identity across pending interaction; deferred compact editor lifecycle), ThreadDetailPromptArea.test.tsx (composer retained + stack ordering), fixed-panel-tabs-sync.test.ts (no rewrite, prune decisions), use-environment-diff-patches.test.tsx (retention lease), PluginNewThreadComposer.test.tsx (root composer before settle, gated queries). Fixes: mobile perf sweep findings E1, E6, E7, E10, D3, D5 (reverted, see below), J3, J4, I6, B28. ## Update (2026-08-19) The deferred compact follow-up editor (D5: static stand-in row + pointerdown/click focus handoff) was removed from this PR after a device test on iPhone showed the caret rendering above the composer after the first tap and a ~11 px footer shift when the real editor replaced the stand-in. The compact composer keeps the previously verified always-mounted behavior (#1263, #1381, #1771). D5 stays open as a follow-up once it can be verified on iOS. Fixes: part of the mobile / iOS Safari performance program (verified sweep report in the bb thread; no single issue). ## Stack context Layer 21 of 22 in the `bb/mobile-perf/*` stack (bottom → top: quick wins first, big rocks last). - Prerequisite (layer below): `bb/mobile-perf/markdown-streaming-and-containment` (#1899). - Next layer: `bb/mobile-perf/diff-and-file-preview` (#1901). - Audit findings addressed: see title IDs. Review: approved-with-fixes; 5 review fix commit(s). - Deliberately not done here: D5: reverted after an iPhone test showed a mispositioned caret and a footer shift; needs a device-verified handoff before it returns - Reviewer notes / follow-ups: Device/iOS Simulator verification still needed for: D5 tap handoff (pointerdown-cancel + click focus with real TipTap; jsdom mocks PromptBoxInternal), E7 deep-content passive swipe | E1: ThreadActionsContextMenu/ProjectActionsContextMenu now branch on useIsCompactViewport, so crossing the compact breakpoint (tablet rotation, window resize) remounts every row's | J4: diff patches now refetch after >60 s away from a thread; turn-summary details/file previews gc after 60 s without observers (by design per audit). - Wire/contract: None. No server/daemon wire, protocol, CLI, plugin API, or DB changes; HOST_DAEMON_PROTOCOL_VERSION untouched. All changes are in apps/app. > AGENT GENERATED: by Claude Code (claude-mangosteen-eap) --------- Co-authored-by: Claude <[email protected]>
Summary
Testing