adopted-ember-addons / adopted-ember-addons/ember-sortable

Updating items and groupName results in error

Aperta
#509 2 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
299
Fork
159
Merge medio
4g 6h
PR unite (30g)
4

Descrizione

**Describe the bug**
Trying to move or drag any item after updating both `items` and `groupName` results in an error.
`Uncaught TypeError: this.sortableGroup is undefined`

**To Reproduce**
~~~hbs


    {{#each this.items as |item|}}

  1. {{item}}


  2. {{/each}}

The last dragged item was: {{this.lastDragged}}

Change data source
~~~

~~~js
export default class FooComponent extends Component {
@tracked lastDragged;
@tracked items = ['A', 'B', 'C'];
@tracked groupName = 'foo_01';

@action
reorderItems(itemModels, draggedModel) {
this.items = itemModels;
this.lastDragged = draggedModel;
}

@action
updateDataSource() {
this.groupName = 'foo_02';
this.items = ['D', 'E', 'F'];
}
}
~~~

1. Render component
2. See default rendered items (A, B, C)
3. Click "Change data source" button
4. See items are changed (D, E, F)
5. Try to move any given item
6. See error

**Expected behavior**
Should be able to move items after they are updated.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.