{"action":"closed","issue":{"url":"https://api.github.com/repos/ractivejs/ractive/issues/1745","labels_url":"https://api.github.com/repos/ractivejs/ractive/issues/1745/labels{/name}","comments_url":"https://api.github.com/repos/ractivejs/ractive/issues/1745/comments","events_url":"https://api.github.com/repos/ractivejs/ractive/issues/1745/events","html_url":"https://github.com/ractivejs/ractive/issues/1745","id":58402051,"number":1745,"title":"Component reset() does not reset arrays","user":{"login":"sixfeetover","id":52384,"avatar_url":"https://avatars.githubusercontent.com/u/52384?v=3","gravatar_id":"","url":"https://api.github.com/users/sixfeetover","html_url":"https://github.com/sixfeetover","followers_url":"https://api.github.com/users/sixfeetover/followers","following_url":"https://api.github.com/users/sixfeetover/following{/other_user}","gists_url":"https://api.github.com/users/sixfeetover/gists{/gist_id}","starred_url":"https://api.github.com/users/sixfeetover/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sixfeetover/subscriptions","organizations_url":"https://api.github.com/users/sixfeetover/orgs","repos_url":"https://api.github.com/users/sixfeetover/repos","events_url":"https://api.github.com/users/sixfeetover/events{/privacy}","received_events_url":"https://api.github.com/users/sixfeetover/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ractivejs/ractive/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/ractivejs/ractive/milestones/12","html_url":"https://github.com/ractivejs/ractive/milestones/0.7.0","labels_url":"https://api.github.com/repos/ractivejs/ractive/milestones/12/labels","id":896204,"number":12,"title":"0.7.0","description":"","creator":{"login":"Rich-Harris","id":1162160,"avatar_url":"https://avatars.githubusercontent.com/u/1162160?v=3","gravatar_id":"","url":"https://api.github.com/users/Rich-Harris","html_url":"https://github.com/Rich-Harris","followers_url":"https://api.github.com/users/Rich-Harris/followers","following_url":"https://api.github.com/users/Rich-Harris/following{/other_user}","gists_url":"https://api.github.com/users/Rich-Harris/gists{/gist_id}","starred_url":"https://api.github.com/users/Rich-Harris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rich-Harris/subscriptions","organizations_url":"https://api.github.com/users/Rich-Harris/orgs","repos_url":"https://api.github.com/users/Rich-Harris/repos","events_url":"https://api.github.com/users/Rich-Harris/events{/privacy}","received_events_url":"https://api.github.com/users/Rich-Harris/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":12,"state":"open","created_at":"2014-12-08T19:28:14Z","updated_at":"2015-03-09T21:38:22Z","due_on":null,"closed_at":null},"comments":7,"created_at":"2015-02-20T19:54:00Z","updated_at":"2015-03-09T21:38:22Z","closed_at":"2015-03-09T21:38:22Z","body":"If you initialize a ractive component with array data, `reset()` will not change array values back to their initial state. In other words:\r\n\r\n```javascript\r\nvar C = Ractive.extend({\r\n  data: {ary: []}\r\n});\r\nc = new C();\r\nc.push('ary', 5)\r\nc.reset()\r\nc.get('ary') // =>  [5]\r\n```\r\n\r\nSee the console output from [this fiddle](http://jsfiddle.net/jfraser/jL3o3nn5/) for a slightly more detailed example. Note that other non-array properties DO reset as expected.\r\n\r\nI noticed this when attempting to override an instance of a Ractive component in my app, where the new instance inherited the array data value from the previous instance. That behavior is also represented in the fiddle. I then tried to use `reset` as a band-aid, but that didn't work either. For now, I have solved it by setting my data in `oninit` rather than as a property of the component.\r\n\r\nI am unclear if this is a bug, the expected behavior for arrays, or simply not the correct usage of `reset`. "}}