{"action":"created","issue":{"url":"https://api.github.com/repos/marko-js/marko-widgets/issues/100","labels_url":"https://api.github.com/repos/marko-js/marko-widgets/issues/100/labels{/name}","comments_url":"https://api.github.com/repos/marko-js/marko-widgets/issues/100/comments","events_url":"https://api.github.com/repos/marko-js/marko-widgets/issues/100/events","html_url":"https://github.com/marko-js/marko-widgets/issues/100","id":112045241,"number":100,"title":"Empty arrays trick stateful components into re-renders.","user":{"login":"tindli","id":6454552,"avatar_url":"https://avatars.githubusercontent.com/u/6454552?v=3","gravatar_id":"","url":"https://api.github.com/users/tindli","html_url":"https://github.com/tindli","followers_url":"https://api.github.com/users/tindli/followers","following_url":"https://api.github.com/users/tindli/following{/other_user}","gists_url":"https://api.github.com/users/tindli/gists{/gist_id}","starred_url":"https://api.github.com/users/tindli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tindli/subscriptions","organizations_url":"https://api.github.com/users/tindli/orgs","repos_url":"https://api.github.com/users/tindli/repos","events_url":"https://api.github.com/users/tindli/events{/privacy}","received_events_url":"https://api.github.com/users/tindli/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-10-18T22:13:09Z","updated_at":"2015-10-27T19:57:59Z","closed_at":"2015-10-27T16:11:40Z","body":"I have found that giving an empty array to a state property in the `getInitialState()` method always tricks stateful widgets into a re-render even if none of the given state properties changed...\r\n\r\nPart of a child-component <app-malicious>:\r\n\r\n```\r\n...\r\ngetInitialState: function (input) {\r\n        return {\r\n             \"usefulProp\": input.text,\r\n             \"completelyUnrelatedProp\": [] // tricks the component into re-renders!\r\n        };\r\n}\r\n...\r\n```\r\n\r\nParent component that uses `<app-malicious>`\r\n```\r\n...\r\n<div>bla bla bla</div>\r\n<app-malicious usefulProp=\"test\"/>\r\n...\r\n```\r\nIf the parent (the one that embeds `<app-malicious>`) re-renders, `<app-malicious>` always re-renders even if \"usefulProp\" did not change... --> \"completelyUnrelatedProp\" tricks the component into a re-render... due to its empty array value...\r\n"},"comment":{"url":"https://api.github.com/repos/marko-js/marko-widgets/issues/comments/151625254","html_url":"https://github.com/marko-js/marko-widgets/issues/100#issuecomment-151625254","issue_url":"https://api.github.com/repos/marko-js/marko-widgets/issues/100","id":151625254,"user":{"login":"tindli","id":6454552,"avatar_url":"https://avatars.githubusercontent.com/u/6454552?v=3","gravatar_id":"","url":"https://api.github.com/users/tindli","html_url":"https://github.com/tindli","followers_url":"https://api.github.com/users/tindli/followers","following_url":"https://api.github.com/users/tindli/following{/other_user}","gists_url":"https://api.github.com/users/tindli/gists{/gist_id}","starred_url":"https://api.github.com/users/tindli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tindli/subscriptions","organizations_url":"https://api.github.com/users/tindli/orgs","repos_url":"https://api.github.com/users/tindli/repos","events_url":"https://api.github.com/users/tindli/events{/privacy}","received_events_url":"https://api.github.com/users/tindli/received_events","type":"User","site_admin":false},"created_at":"2015-10-27T19:57:59Z","updated_at":"2015-10-27T19:57:59Z","body":"Thanks for clarification. \r\n\r\nThere is an issue that discusses further ideas on development: The intelligent object store that keeps references on serialization/de-serialization has aroused by this issue: https://github.com/marko-js/marko-widgets/issues/105"}}