buttonwoodcx / bcx-aurelia-reorderable-repeat

An Aurelia repeater supports drag & drop reordering automatically.
https://buttonwoodcx.github.io/doc-bcx-aurelia-dnd/reorderable-repeat
MIT License
19 stars 5 forks source link

fix(reorderable-repeat): do not move in place while dragging #12

Closed simonfox closed 5 years ago

simonfox commented 5 years ago

When repeating over an array of objects, and using a view that triggers in place modification of that array (viewsRequireLifecycle), moving the views before the drag operation is completed gets the slot views out of sync with the item order.

closes #11

simonfox commented 5 years ago

@3cp I've just updated this with a change in _itemsMutated to ensure that reordering of the source array outside of the repeater is catered for. I've updated the repro to add a reorder button for testing this.

3cp commented 5 years ago

Thx! But this is weird, I need to invest more, it's probably I misunderstood the original repeat logic. Also there is one part in reorderable-repeat is not automatically handled by binding, the add/rmClass which touches all views.

simonfox commented 5 years ago

@3cp I think essentially if we move the view while reordering, this path is followed and thus repeat.updateBindingsdoesn't get called here.

My second change alone actually solves the initial problem, however skipping moveViews while dragging makes the drag much smoother.

simonfox commented 5 years ago

issue fixed via #13

3cp commented 5 years ago

Replaced by #13