Skip to content

feat(web): accept file drops into sidebar threads - #7892

Merged
shivamhwp merged 34 commits into
pingdotgg:mainfrom
UtkarshUsername:feat/sidebar-thread-file-drop
Sep 8, 2026
Merged

shivamhwp merged 34 commits into
pingdotgg:mainfrom
UtkarshUsername:feat/sidebar-thread-file-drop

Conversation

@UtkarshUsername

@UtkarshUsername UtkarshUsername commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Closes #7396

What Changed

Each sidebar thread row (pinned, active, snoozed, settled) is now a drop target for files dragged from the OS. Dropping on a row opens that thread and attaches the files in its composer, ready to send; nothing is ever sent automatically. The row highlights while a file drag hovers over it.

Why

The chat workspace already accepts dropped files, but getting files into an older or background thread meant opening it first, then dragging again. Now one drag does it. Drop on the row, the thread opens, and the files ride the exact same composer path as a workspace drop, so validation, image compression, and focus behave identically.

Rows reuse the existing workspace drop handlers and only react to drags carrying real Files, so pinned-thread reordering and file-tree mention drags are untouched. When the dropped-on thread is not already open, the files are stashed briefly and handed to the composer once navigation lands; if the route bounces (thread gone), the stash is cleared instead of surprising the user later.

Video Demo

drag.mp4

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

ox-alpha via opencode

Note

Add file drop support to sidebar threads in web app

  • Adds drag-and-drop handlers to SidebarThreadRow in Sidebar.tsx to accept files, highlight the row, and navigate to the target thread if needed.
  • Introduces sidebarPendingFileDropStore.ts to queue files during navigation and consume them when the thread composer mounts.
  • ChatView.tsx subscribes to the store, waits for the composer, and attaches queued files to the matching active thread.
  • Clears pending drops for missing threads in the chat route component to prevent stale state.
  • Risk: isSameSidebarThreadRef now compares environmentId and threadId independently to avoid colon-joined key collisions when matching thread references.

Macroscope summarized 26ccad5.


Note

Medium Risk
Cross-component handoff depends on navigation timing and draft-promotion edge cases; a failed composer mount could leave files unstaged, but impact is limited to attachment UX.

Overview
Sidebar thread rows can now receive OS file drags: rows highlight during drag-over, and a drop opens that thread and attaches files in its composer (same validation/compression path as workspace drops—nothing auto-sends).

When the target thread is not already open, files are staged in a new sidebarPendingFileDropStore until navigation finishes; ChatView then calls addDroppedFiles on the composer once the active thread matches and the ref is ready (with requestAnimationFrame retry and guards so draft-promotion / wrong-thread composers do not consume the stash). Sidebar clears the stash if navigation fails or the route does not land on the intended thread; the thread route also clears pending drops when the thread resolves as missing.

User docs note the sidebar file-drop behavior; unit tests cover the pending-drop store.

Reviewed by Cursor Bugbot for commit f4a8be9. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • New Features

    • Added support for dragging files from your computer onto any thread in the sidebar.
    • Dropped files now open the selected thread and appear in the composer for the next message.
    • Multiple file drops are preserved and follow the same per-message file limits as standard attachments.
    • File drops are safely handled when navigation or thread loading is interrupted.
  • Documentation

    • Updated thread sidebar guidance with instructions for attaching files via drag and drop.

Dropping files from the OS onto a sidebar thread row now opens that
thread and attaches the files in its composer, without sending. Rows
reuse the workspace drop handlers (Files-type gate only), so pinned
reordering and mention drags are unaffected. Files dropped on a row
that is not the open thread are stashed and handed to the composer once
the navigation lands; if the route bounces the stash is cleared.

Ends with model/harness info: ox-alpha (opencode)
@coderabbitai

ghost commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: b8298154-3946-4f73-9167-6517ca001f36

📥 Commits

Reviewing files that changed from the base of the PR and between 7b8873b and 520d29a.

📒 Files selected for processing (2)
  • apps/web/src/components/LegacySidebar.tsx
  • apps/web/src/components/Sidebar.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

Sidebar thread rows now accept dropped files, queue them by thread, navigate to the target thread, and attach them to the composer after loading. Missing-thread cleanup removes stale drops. Tests and documentation cover the flow.

Changes

Sidebar file drop integration

Layer / File(s) Summary
Pending drop state and validation
apps/web/src/sidebarPendingFileDropStore.ts, apps/web/src/sidebarPendingFileDropStore.test.ts
The Zustand store queues drops by scoped thread reference, consumes them oldest-first, and supports identity-based cleanup. Tests cover accumulation, isolation, cleanup, and reference-collision handling.
Sidebar drop handling and navigation
apps/web/src/components/Sidebar.tsx, apps/web/src/components/LegacySidebar.tsx
Thread rows accept external file drops, show drag-over state, queue files, navigate to the target thread, and clear drops when navigation fails or lands elsewhere.
Composer consumption and route cleanup
apps/web/src/components/ChatView.tsx, apps/web/src/routes/_chat.$environmentId.$threadId.tsx, docs/user/thread-sidebar.md
ChatView consumes matching drops after the composer mounts. Missing-thread routes clear pending drops. The sidebar documentation describes the new behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 520d2

Dropping files onto sidebar and search-result thread rows opens the target thread and attaches the files to its composer without sending them. Repeated drops and failed navigation cleanup preserve the intended files, with no remaining merge-readiness risk identified.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant SidebarThreadRow
  participant Sidebar
  participant Router
  participant ChatView
  participant Composer
  User->>SidebarThreadRow: Drop files
  SidebarThreadRow->>Sidebar: Forward thread ref and files
  Sidebar->>Sidebar: Queue pending file drop
  Sidebar->>Router: Navigate to thread
  Router-->>ChatView: Activate thread
  ChatView->>ChatView: Consume matching pending drop
  ChatView->>Composer: Add dropped files
Loading

Suggested reviewers: juliusmarminge, t3dotgg

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: accepting file drops into sidebar threads.
Description check ✅ Passed The description explains what changed, why it changed, the interaction behavior, navigation cleanup, and testing-related details. It includes a video for the UI interaction. Before-and-after screensho…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 22, 2026
Comment thread apps/web/src/components/ChatView.tsx Resolved
Comment thread apps/web/src/components/Sidebar.tsx Resolved

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One finding: the new sidebar drag-over highlight uses a Tailwind color token that does not exist, so the ring falls back to currentColor and changes appearance per row state. Details inline.

Posted via Macroscope — UI Consistency

Comment thread apps/web/src/components/Sidebar.tsx Resolved
Move the pending-drop hooks above ChatView's no-active-thread early
return so hook order cannot change when a thread opens or closes. Only
clear the pending stash when it still belongs to the drop that missed
its landing, so a newer drop is never wiped by an older navigation. Use
the existing ring-ring token for the row highlight instead of the
nonexistent ring-sidebar-ring.

Ends with: ox-alpha (opencode)

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One finding on the new drag-over highlight for sidebar thread rows: the outer ring is clipped by the row container's paint containment, leaving the drop target visually identical to hover. Details inline.

Posted via Macroscope — UI Consistency

Comment thread apps/web/src/components/Sidebar.tsx Resolved
UtkarshUsername and others added 3 commits August 22, 2026 16:36
The row li's content-visibility paint containment clips outer rings,
so the drag-over affordance read as plain hover. Use an inset ring, the
sidebar's own ring convention, tinted with primary to match the other
file-drop surfaces instead of the focus-ring token.

Ends with: ox-alpha (opencode)
@UtkarshUsername
UtkarshUsername marked this pull request as ready for review August 22, 2026 14:37
Comment thread apps/web/src/components/Sidebar.tsx Resolved
@macroscopeapp

ghost commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR adds a new file-drop workflow across sidebar rows, navigation, shared pending state, route handling, and composer attachment processing. Its cross-component runtime behavior and lifecycle coordination are broader than a small isolated UI change, so human review is appropriate.

You can add or adjust custom eligibility rules. Learn more.

The missing-thread redirect fires in an effect after navigation
resolves, so the drop's landing check had already passed and the stash
was never consumed or cleared. Clear it here, scoped to the dead
thread, before navigating home.

Ends with: ox-alpha (opencode)
An environment with no threads left leaves the route parked on the
missing thread instead of redirecting home, so the stash survived. Move
the release out of the redirect condition.

Ends with: ox-alpha (opencode)
@UtkarshUsername UtkarshUsername changed the title feat(web): sidebar thread rows accept file drops [WIP] feat(web): sidebar thread rows accept file drops Aug 22, 2026
@UtkarshUsername UtkarshUsername changed the title [WIP] feat(web): sidebar thread rows accept file drops feat(web): sidebar thread rows accept file drops Aug 22, 2026
@UtkarshUsername UtkarshUsername changed the title feat(web): sidebar thread rows accept file drops feat(web): accept file drops on sidebar thread rows Aug 22, 2026
@UtkarshUsername UtkarshUsername changed the title feat(web): accept file drops on sidebar thread rows feat(web): accept file drops into sidebar threads Aug 22, 2026

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One finding on the new sidebar drop-target styling. The ring token/inset issues from the previous rounds look resolved (ring-1 ring-inset ring-primary/70 matches the composer's drop-target treatment and the inset ring is no longer clipped by the row's content-visibility: auto ancestor).

Posted via Macroscope — UI Consistency

Comment thread apps/web/src/components/Sidebar.tsx Resolved
Comment thread apps/web/src/components/Sidebar.tsx Resolved
UtkarshUsername and others added 2 commits August 24, 2026 19:55
The drag tint overrode an active/selected row's own background via
twMerge, dimming the route cue on the most common drop target; apply it
only to rows without a state surface. A rejected navigation also
orphaned the stash with an unhandled rejection; clear it in a catch.

Ends with: ox-alpha (opencode)
@cursor

ghost commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

@shivamhwp

ghost commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Note: GPT-6 on behalf of shivam (@shivamhwp).

Two sidebar paths still ignore file drops:

  • Search results use SidebarSearchResultRow, which has no file-drop handlers. Searching for an older thread and dropping a file on its result leaves the current thread open and attaches nothing.
  • Enabling Settings → General → Legacy features → Sidebar switches to LegacySidebar, whose thread rows also have no file-drop handlers.

Please connect search-result rows to the same attachment and navigation handler. For the legacy sidebar, either support the same behavior or explicitly document the limitation; the current docs promise drops onto "any thread row."

@cursor

ghost commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

@UtkarshUsername

ghost commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

@shivamhwp,

Implemented the feature in the two sidebar paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants