Skip to content

[DragDrop] Model & view update during drag breaks drag & drop #18628

Closed
lingounet/testage
#29
@mstawick

Description

@mstawick

Reproduction scenario is trivial. This can happen in muli-user environments where data updates are pushed and merged live.

Reproduction

https://stackblitz.com/edit/components-issue-crtxst?file=src%2Fapp%2Fexample-component.html

  1. Open repro - there are 4 buttons,
  2. Wait 3 seconds - there are 2 different buttons. They can be dragged,
  3. Now refresh the page, and as soon as it loads start dragging "Button 1". Hold it,
  4. After 3 seconds model is updated, dragging is cancelled, and dragging is no longer possible.

On stackblitz, I don't see any errors logged. However, on my production app, I got something logged via Sentry that points to this transpiled piece of code in fesm2015/drag-drop.js:

1078                 (event) => {
1079                     if (!event || (event.target === this._preview && event.propertyName === 'transform')) {
1080                         this._preview.removeEventListener('transitionend', handler);
1081                         resolve();
1082                         clearTimeout(timeout);
1083                     }
1084                 }))));

with error being:
TypeError: Cannot read property 'removeEventListener' of null

Expected Behavior

Dragging should be possible with new items

Actual Behavior

Dragging doesn't work until page is reloaded

Environment

  • Angular: 9.0.2
  • CDK/Material: 9.0.1
  • Browser(s): Chrome 80
  • Operating System (e.g. Windows, macOS, Ubuntu): Ubuntu

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions