binding: Adding and then sorting an array breaks repeat binding
When adding (push
ing) to an array and then sorting the result, a repeat binding doesn’t update correctly.
I have created a repro here. I have added a repeat
binding over a collection to the Welcome
view model. There are a couple buttons below, one to add then sort and one to add without sort. If you use add with sort, you will see the unexpected behavior.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 23 (17 by maintainers)
Commits related to this issue
- test(repeat-integration-spec): add failing test for push sort bug Failing test for bug aurelia/binding#233 — committed to aurelia/templating-resources by martingust 9 years ago
- test(repeat-integration-spec): add failing test for push sort bug Failing test for bug aurelia/binding#233 — committed to aurelia/templating-resources by jdanyow 9 years ago
I’m coming across a similar issue and can’t get it to work. In an array (
this.steps
): I need to move an item from a position to another (indexpreviousPosition
tonewPosition
). This array is used in a repeater in the view.Here are the relevant parts of the code I’ve tried:
steps.js (VM)
steps.html
Both options have problems when the view gets updated. Sometime the moved item gets duplicated, sometimes the array gets an empty new item, sometimes an item gets missing, …
Is this stil a bug in the binding system or am I doing something wrong when updating the array ?