Lite: add ability to drag and drop uncommitted changes onto a branch#13143
Lite: add ability to drag and drop uncommitted changes onto a branch#13143OliverJAsh merged 3 commits intomasterfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
There was a problem hiding this comment.
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
TreeChangesand translate them into aCommitCreateoperation. - Add
CommitCreatesupport to the generic operation runner (useRunOperation) using the existingcommitCreatemutation. - 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 TreeChanges → CommitCreate, 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. |
| 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: "", |
There was a problem hiding this comment.
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.
No description provided.