git ssb

1+

Matt McKegg / mutant



Commit 21e21c93b334c79676b367cacbd519536c968bd2

mapped-array: fix move

Matt McKegg committed on 9/11/2016, 9:59:01 AM
Parent: 13c491b3bb6c89a2546fd4301ea7396625a55e9d

Files changed

mapped-array.jschanged
mapped-array.jsView
@@ -36,13 +36,17 @@
3636 var currentIndex = obs.indexOf(mappedItem)
3737 if (~currentIndex) {
3838 var item = list.get(currentIndex)
3939 if (currentIndex < targetIndex) {
40- list.insert(item, targetIndex + 1)
41- list.deleteAt(currentIndex)
42- } else {
43- list.insert(item, targetIndex)
44- list.deleteAt(currentIndex)
40+ list.transaction(function () {
41+ list.insert(item, targetIndex + 1)
42+ list.deleteAt(currentIndex)
43+ })
44+ } else if (currentIndex > targetIndex) {
45+ list.transaction(function () {
46+ list.insert(item, targetIndex)
47+ list.deleteAt(currentIndex + 1)
48+ })
4549 }
4650 }
4751 }
4852

Built with git-ssb-web