Skip to content

fix(dnd): lists can't be reordered when dropped over another list's cards - #8626

Open
solyin-enof wants to merge 2 commits into
nextcloud:mainfrom
solyin-enof:fix/stack-drag-into-card-list
Open

solyin-enof wants to merge 2 commits into
nextcloud:mainfrom
solyin-enof:fix/stack-drag-into-card-list

Conversation

@solyin-enof

Copy link
Copy Markdown
  • Resolves:
  • Target version: main

Summary

Dragging a list to a new position usually doesn't save: the list snaps back.

Each list's card Container sets :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 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 gets addedIndex: null. The client then sends:

PUT /ocs/v2.php/apps/deck/api/v1.0/stacks/6/reorder   {"order":null,"boardId":2}            → 400
PUT /ocs/v2.php/apps/deck/api/v1.0/cards/undefined/reorder  {"stackId":5,"order":1,...}     → 403

The 403 is onDropCard running with the list's undefined payload.

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 catch calls OC.Notification.showTemporary, but OC.Notification was removed from server (it's in core/src/OC/index.js on stable33 and gone from stable34). The handler threw TypeError: 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 remaining OC.Notification calls (AppNavigationBoard.vue, SharingApi.js) with showError from @nextcloud/dialogs.

Testing

  • Reproduced on Nextcloud 35.0.2 with Deck 1.19.1: dropping a list over another list's cards produced the two failing requests above, and the list didn't move.
  • Applied the same shouldAcceptDrop change to 1.19.1 (built from v1.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).
  • On this branch: eslint passes on the changed files and npm run build succeeds. 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

  • Code is properly formatted
  • Sign-off message is added to all commits
  • Tests (unit, integration, api and/or acceptance) are included. There's no drag-and-drop coverage to extend, so tested manually as described above.
  • Documentation (manuals or wiki) has been updated or is not required

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

🤖 Generated with Claude Code

solyin-enof and others added 2 commits October 27, 2026 05:49
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>
@github-actions

Copy link
Copy Markdown
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

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.)

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants