fix: move a task instead of duplicating it when dragged between notes#889
Open
RIDAM7 wants to merge 1 commit into
Open
fix: move a task instead of duplicating it when dragged between notes#889RIDAM7 wants to merge 1 commit into
RIDAM7 wants to merge 1 commit into
Conversation
Each day in the daily stream is a separate ProseMirror EditorView, so dragging a task from one day to another is a cross-view drag. ProseMirror only deletes the dragged content in the view where the drop lands, so a cross-view move inserted a copy in the target while leaving the original in the source, and the task appeared in both notes. Add a document-level bridge that coordinates the mounted note views and completes the move by deleting the source node ProseMirror skipped, gated so a cancelled or copy drag loses nothing. Fixes team-reflect#747
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughAdds cross-editor drag-move handling to desktop note editors. Document listeners track drag sources and drop targets, then delete moved nodes or selections from the source editor while preserving copies, same-editor drags, and cancelled drops. ChangesCross-note drag move
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Source editor
participant CrossNoteDragMove
participant Target editor
Source editor->>CrossNoteDragMove: dragstart
Target editor->>CrossNoteDragMove: accepted drop
CrossNoteDragMove->>Source editor: delete moved node or selection
CrossNoteDragMove->>Source editor: dispatch drop transaction
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Author
|
This is Screen Recording after fix #747. Fix.747.Screen.Recording.mp4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #747
Problem
The daily stream mounts one ProseMirror
EditorViewper day, so dragging a taskfrom one day onto another is a drag between two editor instances. ProseMirror
only deletes dragged content in the view where the drop lands, so the target
inserted a copy while the source kept the original — the task ended up in both notes.
Fix
The block-handle grip is a floating element outside any
view.dom, so this adds adocument-level bridge (
cross-note-drag-move.tsx) that tracks the mounted noteviews, and on the source view's
dragend— when the drop landed in a differenteditor and it was a move — runs the delete ProseMirror skipped, using PM's own drag
record (
dragging.node.replace, the same call a same-view move uses). A cancelleddrop or a copy drag deletes nothing, so neither can lose the original.
The move decision is factored into a pure
crossNoteMoveDeletionhelper with unittests. Native drag-and-drop can't run under vitest/jsdom, so the gesture itself was
verified manually in the running app; the automated coverage is the decision logic.
Testing
pnpm typecheck,pnpm lint,pnpm testpasspnpm tauri:dev: dragging a task between daily notes nowmoves it to a single note; a drop cancelled mid-drag leaves the original intact.
Summary by CodeRabbit
New Features
Tests