Skip to content

Lite: add ability to drag and drop uncommitted changes onto a branch#13143

Merged
OliverJAsh merged 3 commits intomasterfrom
push-pnyuqkroppvo
Apr 1, 2026
Merged

Lite: add ability to drag and drop uncommitted changes onto a branch#13143
OliverJAsh merged 3 commits intomasterfrom
push-pnyuqkroppvo

Conversation

@OliverJAsh
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings April 1, 2026 17:23
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
gitbutler-web Skipped Skipped Apr 1, 2026 5:23pm

Request Review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support in the Lite workspace UI for dragging uncommitted (worktree) changes onto a branch target, triggering a commit creation operation at the drop location.

Changes:

  • Extend branch drop-target logic to accept dragged TreeChanges and translate them into a CommitCreate operation.
  • Add CommitCreate support to the generic operation runner (useRunOperation) using the existing commitCreate mutation.
  • Simplify the “Unassigned changes” lane markup and adjust related CSS.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
apps/lite/ui/src/routes/project/$id/workspace/route.tsx Adds branch drop handling for TreeChangesCommitCreate, updates tooltip text, and tweaks workspace lane markup/classes.
apps/lite/ui/src/routes/project/$id/workspace/route.module.css Removes the extra lane wrapper styles and adjusts .unassignedChanges styling to own sizing/border.
apps/lite/ui/src/Operation.ts Adds CommitCreate to the Operation union and executes it via commitCreateMutationOptions in useRunOperation.

Comment on lines +1354 to +1366
Match.tag("TreeChanges", ({ source }): Operation | null => {
if (anchorRef === null || source.parent._tag !== "Changes") return null;
return {
_tag: "CommitCreate",
relativeTo: {
type: "referenceBytes",
subject: anchorRef,
},
side: "below",
changes: source.changes.map(({ change, hunkHeaders }) =>
createDiffSpec(change, hunkHeaders),
),
message: "",
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

useDroppable calls the provided getData on every onDrag event. Building changes: source.changes.map(...createDiffSpec...) here means we recompute DiffSpecs repeatedly while hovering/moving over this branch target, which can be expensive for large change sets. Consider keeping the drop-target data lightweight (e.g., just relativeTo/side) and computing DiffSpecs once on drop (e.g., in the monitor’s onDrop handler) or caching the computed DiffSpecs for the current drag source.

Copilot uses AI. Check for mistakes.
@OliverJAsh OliverJAsh enabled auto-merge April 1, 2026 17:29
@OliverJAsh OliverJAsh merged commit d64f321 into master Apr 1, 2026
41 checks passed
@OliverJAsh OliverJAsh deleted the push-pnyuqkroppvo branch April 1, 2026 17:37
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