fix(drag-and-drop): track all droppable-mailbox directive instances independently#12650
Open
cdvv7788 wants to merge 2 commits intonextcloud:mainfrom
Open
fix(drag-and-drop): track all droppable-mailbox directive instances independently#12650cdvv7788 wants to merge 2 commits intonextcloud:mainfrom
cdvv7788 wants to merge 2 commits intonextcloud:mainfrom
Conversation
|
Thanks for opening your first pull request in this repository! ✌️ |
…ndependently Signed-off-by: Cristian <cristianvargasvalencia@gmail.com>
Contributor
|
Thanks for your pr 👍 |
There was a problem hiding this comment.
Pull request overview
Fixes a drag-and-drop regression where only the last mounted droppable-mailbox directive instance worked, by tracking directive instances per element and cleaning up listeners on unmount.
Changes:
- Replace the single shared directive
instancewith aninstancescollection and look up the correct instance byel. - Add
unbind/unmountedcleanup to remove event listeners and prevent leaks. - Add unit tests covering multiple instances, correct updates, and listener cleanup behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/directives/drag-and-drop/droppable-mailbox/index.js | Track multiple directive instances and add unbind/unmounted cleanup. |
| src/directives/drag-and-drop/droppable-mailbox/droppable-mailbox.js | Store bound listener references so removeListeners detaches correctly; avoid resetting drag state on update. |
| src/tests/unit/directives/droppable-mailbox.spec.js | Add tests for multi-instance behavior, correct updates, and listener removal. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/directives/drag-and-drop/droppable-mailbox/droppable-mailbox.js
Outdated
Show resolved
Hide resolved
kesselb
reviewed
Mar 25, 2026
Contributor
|
Thanks a lot @cdvv7788 for fixing it. Could you check the linter and have brief look at copilots suggestions? The update one seems valid. The "brittle" tests is accetable for me. |
Author
|
I will check them, they are all relatively simple to fix. |
Signed-off-by: Cristian <cristianvargasvalencia@gmail.com>
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.
The droppable-mailbox directive used a single shared
instancevariable that was overwritten each time a mailbox mounted. This meant only the last-rendered folder in the sidebar had working drag-and-drop, while all others silently failed.Changes:
Fixes #11930
I added some tests. If you run them against the old code you should be able to see the error. I am able to drop it in the new folders after the changes.