fix(email): open search thread results at latest message expanded#5044
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe changes ensure target messages are expanded before navigation logic performs pagination, scrolling, and focus updates. Unified-list routing now excludes email snippet entities from deriving a location from the snippet hit when no explicit location is provided, while preserving that fallback for non-email snippet entities. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/web/src/features/next-soup/utils.ts (1)
469-474: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd regression coverage for email snippet routing.
In
apps/web/src/features/next-soup/utils.test.ts, cover: email entities without an explicit location, email entities with an explicit content-hit location, and non-email snippet entities retaining their fallback location.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/src/features/next-soup/utils.ts` around lines 469 - 474, Extend the tests for the routing logic around isHitSnippetEntity and getSnippetHit to cover email entities without an explicit location, email entities preserving an explicit content-hit location, and non-email snippet entities receiving their fallback location. Assert each resulting location to prevent regressions in the behavior implemented in utils.ts.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@apps/web/src/features/next-soup/utils.ts`:
- Around line 469-474: Extend the tests for the routing logic around
isHitSnippetEntity and getSnippetHit to cover email entities without an explicit
location, email entities preserving an explicit content-hit location, and
non-email snippet entities receiving their fallback location. Assert each
resulting location to prevent regressions in the behavior implemented in
utils.ts.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c61bad77-a853-4d00-9dcc-1de252aae879
📒 Files selected for processing (2)
apps/web/src/features/block-email/component/Email.tsxapps/web/src/features/next-soup/utils.ts
Summary
Clicking an email thread row in search results landed at the oldest matched message with every message collapsed. It now behaves like opening a thread from the soup view (Superhuman-style): land on the newest message (or first unread), which renders expanded.
Root cause
openEntityInSplitFromUnifiedListpromoted the row's best snippet hit into a navigation target for email rows, setting theemail_message_idparam. The email block then scrolled to that (often oldest) matched message.Changes
next-soup/utils.ts: the snippet-hit fallback on plain row clicks now skips email entities, so email rows open with the block's default initial scroll (first unread, else latest — both expanded). Call rows keep the fallback, and clicking a specific content-hit snippet still passes an explicit location and navigates to that exact message.block-email/Email.tsx:handleTargetMessageexpands the target message body before scrolling, so explicit hit navigation never lands on a collapsed row.