Repository navigation
fix(dnd): lists can't be reordered when dropped over another list's cards - #8626
solyin-enof wants to merge 2 commits into
Conversation
Each list's card Container passes shouldAcceptDrop="() => canEdit".
In smooth-dnd a shouldAcceptDrop callback replaces the default
relevance check (same container, or matching groupName), so every card
list also accepts a dragged list as if it were a card.
When a list is dropped with the pointer over another list's cards, the
card list takes the drop. The board container then gets addedIndex
null, and the client sends {"order": null} to
/stacks/{id}/reorder (400) plus a reorder for card "undefined" (403).
The list does not move.
Only accept drops whose source container is a card list
(groupName "stack"), which keeps moving cards between lists working.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: solyin-enof <340926352+solyin-enof@users.noreply.github.com>
OC.Notification no longer exists in server (gone from core/src/OC since stable34), so these error paths threw a TypeError instead of showing a message. In orderStack this also skipped restoring the previous list order after a failed reorder, leaving the board showing an order that was never saved. Use showError from @nextcloud/dialogs, as the rest of the app does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: solyin-enof <340926352+solyin-enof@users.noreply.github.com>
54944a9 to
2e37b4c
Compare
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Summary
Dragging a list to a new position usually doesn't save: the list snaps back.
Each list's card
Containersets:shouldAcceptDrop="() => canEdit". In smooth-dnd ashouldAcceptDropcallback replaces the default relevance check (same container, or matchinggroupName). So every card list also accepts a dragged list as if it were a card. When you drop a list with the pointer over another list's cards, which cover most of a list, that card list takes the drop and the board container getsaddedIndex: null. The client then sends:The 403 is
onDropCardrunning with the list'sundefinedpayload.Commit 1 makes the card lists accept only drops from another card list (
sourceOptions.groupName === 'stack'), so the board container gets the list drop and moving cards between lists still works.Commit 2 fixes the error path. The failed reorder's
catchcallsOC.Notification.showTemporary, butOC.Notificationwas removed from server (it's incore/src/OC/index.json stable33 and gone from stable34). The handler threwTypeError: Cannot read properties of undefined (reading 'showTemporary')before it restored the previous order, so the board kept showing an order that was never saved. I replaced it and the two other remainingOC.Notificationcalls (AppNavigationBoard.vue,SharingApi.js) withshowErrorfrom@nextcloud/dialogs.Testing
shouldAcceptDropchange to 1.19.1 (built fromv1.19.1, installed on that instance). Moving a list then sent{"order":0}→ 200 and the order stayed after a reload. Dragging a card into another list still saved (200).eslintpasses on the changed files andnpm run buildsucceeds. I haven't run this branch against a Nextcloud 36 instance; the changed lines are the same as on 1.19.1 apart from the camelCase prop.Checklist
🤖 AI (if applicable)
🤖 Generated with Claude Code