Open SebastianPodgajny opened 4 days ago
I spent a bit of time investigating it. The problem is that we need to insert some elements while the dragging is happening (e.g. the placeholder and the preview) which get cleaned up once it's done, but in this case @for
is trying to re-render while those elements are still there. Normally we have some backup logic in place which will do the cleanup if the dragged element is destroyed, but that doesn't happen here because @for
tries to reuse the element rather than destroy it. There isn't an API that we can use to be notified when something like this has happened.
I'm setting a lower priority on this, because it's a bit of an edge case and in general it's not recommended to change the data while the user is dragging since they might not notice what's going on.
Is this a regression?
The previous version in which this bug was not present was
No response
Description
When drag and drop is used and data refreshes in background this error can be thrown
Reproduction
StackBlitz link: https://stackblitz.com/edit/a9tq3w?file=src%2Fexample%2Fcdk-drag-drop-connected-sorting-example.html Steps to reproduce:
Expected Behavior
Drag and drop should not cause
DOMException
Actual Behavior
https://github.com/angular/components/assets/21180501/9e1cee2a-d9e4-4460-a049-74821a66c827
https://github.com/angular/components/assets/21180501/ecaed375-0a32-404b-bbc2-860b58d1fe6d
Environment
Angular CLI: 18.0.2 Node: 18.20.3 Package Manager: yarn 1.22.19 OS: linux x64
Angular: 18.0.1 ... animations, common, compiler, compiler-cli, core, forms ... localize, platform-browser, platform-browser-dynamic, router
Package Version
@angular-devkit/architect 0.1800.2 @angular-devkit/build-angular 18.0.2 @angular-devkit/core 18.0.2 @angular-devkit/schematics 18.0.2 @angular/cdk 18.0.5 @angular/cli 18.0.2 @angular/material 18.0.5 @angular/material-experimental 18.0.5 @angular/material-moment-adapter 18.0.5 @schematics/angular 18.0.2 rxjs 7.4.0 typescript 5.4.5 zone.js 0.14.6