Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cdk/drag-drop): avoid retaining destroyed items until next drag #30514

Merged
merged 1 commit into from
Feb 19, 2025

Conversation

crisbeto
Copy link
Member

We have some logic that registers and de-registers the items on create/destroy. That logic only syncs the item with the internal DragRef once the next dragging starts which means that we might retain a destroyed item if another drag doesn't start.

These changes switch to always syncing the list when an item is removed.

I've also added some context around why things are set up as they are right now since it took a while to remember the reasoning.

Fixes #30506.

We have some logic that registers and de-registers the items on create/destroy. That logic only syncs the item with the internal `DragRef` once the next dragging starts which means that we might retain a destroyed item if another drag doesn't start.

These changes switch to always syncing the list when an item is removed.

I've also added some context around why things are set up as they are right now since it took a while to remember the reasoning.

Fixes angular#30506.
@crisbeto crisbeto added the target: patch This PR is targeted for the next patch release label Feb 19, 2025
@crisbeto crisbeto requested a review from a team as a code owner February 19, 2025 09:04
@crisbeto crisbeto requested review from mmalerba and wagnermaciel and removed request for a team February 19, 2025 09:04
@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Feb 19, 2025
@crisbeto crisbeto merged commit 26765a4 into angular:main Feb 19, 2025
22 of 25 checks passed
@crisbeto
Copy link
Member Author

The changes were merged into the following branches: main, 19.1.x

crisbeto added a commit that referenced this pull request Feb 19, 2025
…30514)

We have some logic that registers and de-registers the items on create/destroy. That logic only syncs the item with the internal `DragRef` once the next dragging starts which means that we might retain a destroyed item if another drag doesn't start.

These changes switch to always syncing the list when an item is removed.

I've also added some context around why things are set up as they are right now since it took a while to remember the reasoning.

Fixes #30506.

(cherry picked from commit 26765a4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker area: cdk/drag-drop target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[drag-drop] cdk-drag node is detached after element is dropped from one container to another
2 participants