{"action":"created","issue":{"url":"https://api.github.com/repos/emberjs/ember.js/issues/11880","labels_url":"https://api.github.com/repos/emberjs/ember.js/issues/11880/labels{/name}","comments_url":"https://api.github.com/repos/emberjs/ember.js/issues/11880/comments","events_url":"https://api.github.com/repos/emberjs/ember.js/issues/11880/events","html_url":"https://github.com/emberjs/ember.js/issues/11880","id":96955249,"number":11880,"title":"each helper not updating changes","user":{"login":"QuantumKing","id":235305,"avatar_url":"https://avatars.githubusercontent.com/u/235305?v=3","gravatar_id":"","url":"https://api.github.com/users/QuantumKing","html_url":"https://github.com/QuantumKing","followers_url":"https://api.github.com/users/QuantumKing/followers","following_url":"https://api.github.com/users/QuantumKing/following{/other_user}","gists_url":"https://api.github.com/users/QuantumKing/gists{/gist_id}","starred_url":"https://api.github.com/users/QuantumKing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/QuantumKing/subscriptions","organizations_url":"https://api.github.com/users/QuantumKing/orgs","repos_url":"https://api.github.com/users/QuantumKing/repos","events_url":"https://api.github.com/users/QuantumKing/events{/privacy}","received_events_url":"https://api.github.com/users/QuantumKing/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2015-07-24T03:32:11Z","updated_at":"2015-08-21T19:26:24Z","closed_at":null,"body":"I have a component `sortable-list` which has the following template\r\n```hbs\r\n<!-- templates/components/sortable-list.hbs -->\r\n{{#each items as |item index|}}\r\n  {{yield item index}}\r\n{{/each}}\r\n```\r\nand code\r\n```js\r\n// components/sortable-list.js\r\nexport default Ember.Component.extend(PreserveScroll, {\r\n  initSortable: function() {\r\n    var refreshed = false;\r\n    var _this = this;\r\n\r\n    this.$().sortable({\r\n      axis: 'y',\r\n      update: function(event, ui) {\r\n        Ember.run.scheduleOnce('afterRender', this, function(){\r\n          var id = ui.item.data('id').toString();\r\n          var idx = Ember.$(this).children().index(ui.item);\r\n          Ember.$(this).sortable('cancel');\r\n          _this.updateItemOrder(id, idx);\r\n        });\r\n      },\r\n      start: function() { // event, ui\r\n        if (!refreshed) {\r\n          _this.$().sortable('refreshPositions');\r\n          refreshed = true;\r\n        }\r\n      }\r\n    });\r\n  }.on('didInsertElement'),\r\n\r\n  destroySortable: function() {\r\n    this.$().sortable('destroy');\r\n  }.on('willDestroyElement'),\r\n\r\n  updateItemOrder: function(key, idx) {\r\n    var items = this.get('items');\r\n    var item  = items.findBy('id', key);\r\n    this.beginPropertyChanges();\r\n    items.removeObject(item);\r\n    items.insertAt(idx, item);\r\n    this.endPropertyChanges();\r\n  }\r\n});\r\n```\r\nIn one of my templates I have\r\n```hbs\r\n<!-- templates/draft/index.hbs -->\r\n{{#sortable-list items=model.items as |item index|}}\r\n  {{item-summary item=item index=index}}\r\n{{/sortable-list}}\r\n```\r\nThe problem I'm having is when I sort the items and `updateItemOrder` gets called, with `removeObject` and `insertAt` updating the `items` array, the list is not being re-rendered. This used to work before I moved this code from my route's view to a component."},"comment":{"url":"https://api.github.com/repos/emberjs/ember.js/issues/comments/133537198","html_url":"https://github.com/emberjs/ember.js/issues/11880#issuecomment-133537198","issue_url":"https://api.github.com/repos/emberjs/ember.js/issues/11880","id":133537198,"user":{"login":"stevehanson","id":1691324,"avatar_url":"https://avatars.githubusercontent.com/u/1691324?v=3","gravatar_id":"","url":"https://api.github.com/users/stevehanson","html_url":"https://github.com/stevehanson","followers_url":"https://api.github.com/users/stevehanson/followers","following_url":"https://api.github.com/users/stevehanson/following{/other_user}","gists_url":"https://api.github.com/users/stevehanson/gists{/gist_id}","starred_url":"https://api.github.com/users/stevehanson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevehanson/subscriptions","organizations_url":"https://api.github.com/users/stevehanson/orgs","repos_url":"https://api.github.com/users/stevehanson/repos","events_url":"https://api.github.com/users/stevehanson/events{/privacy}","received_events_url":"https://api.github.com/users/stevehanson/received_events","type":"User","site_admin":false},"created_at":"2015-08-21T19:26:24Z","updated_at":"2015-08-21T19:26:24Z","body":"@dmagunov oh, i see. Thought you were having the same problem with jQuery UI sortable. Your case seems a little trickier :("}}