{"action":"created","issue":{"url":"https://api.github.com/repos/riot/riot/issues/2196","repository_url":"https://api.github.com/repos/riot/riot","labels_url":"https://api.github.com/repos/riot/riot/issues/2196/labels{/name}","comments_url":"https://api.github.com/repos/riot/riot/issues/2196/comments","events_url":"https://api.github.com/repos/riot/riot/issues/2196/events","html_url":"https://github.com/riot/riot/issues/2196","id":198372737,"number":2196,"title":"Some honest thoughts on the changes of v2 to v3","user":{"login":"alexssung","id":2774543,"avatar_url":"https://avatars.githubusercontent.com/u/2774543?v=3","gravatar_id":"","url":"https://api.github.com/users/alexssung","html_url":"https://github.com/alexssung","followers_url":"https://api.github.com/users/alexssung/followers","following_url":"https://api.github.com/users/alexssung/following{/other_user}","gists_url":"https://api.github.com/users/alexssung/gists{/gist_id}","starred_url":"https://api.github.com/users/alexssung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexssung/subscriptions","organizations_url":"https://api.github.com/users/alexssung/orgs","repos_url":"https://api.github.com/users/alexssung/repos","events_url":"https://api.github.com/users/alexssung/events{/privacy}","received_events_url":"https://api.github.com/users/alexssung/received_events","type":"User","site_admin":false},"labels":[{"id":224827161,"url":"https://api.github.com/repos/riot/riot/labels/discussion","name":"discussion","color":"ff44aa","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-01-02T19:24:43Z","updated_at":"2017-01-31T20:53:31Z","closed_at":"2017-01-09T14:51:55Z","body":"1. Describe your issue:\r\n\r\nThere are a couple of changes in v3 that I felt were a step backwards. I really enjoy riot and the experience it provides to us developers, so I hope you guys take the following into consideration.\r\n\r\nFirst, refs do not work the same way as tags used to work--you now must wait for the mounted event. Not only does this make the code verbose, this also complicates templating as you must check for the ref in the parent's template before accessing the ref's attributes.\r\n\r\nSecond, why remove support for spaced observable events? Now that the update and mount events are triggered separately, listening to multiple events in one place would be very nice. It feels like this feature was removed right when it was needed.\r\n\r\n2. Can you reproduce the issue?\r\n\r\nAs mentioned by @Infeligo in #2146, when accessing a ref's attribute in a template expression:\r\n\r\n```\r\n<div>{ refs.username.value }</div>\r\n```\r\n\r\nIt throws an error since the ref is not available until the mount event, so we must check for the ref every time we want to access its attributes, like:\r\n\r\n```\r\n<div>{ refs.username && refs.username.value }</div>\r\n```\r\n\r\nFeels unnecessarily verbose and does not fit in with the minimal and simple philosophy of Riot. This would not be an issue if refs behaved the same way as tags used to.\r\n\r\nAs for the spaced events, in v2 I could listen to all update events including mount via:\r\n\r\n```\r\nthis.on(\"update\", function() { /* do update */ })\r\n```\r\n\r\nNow it must be done like:\r\n\r\n```\r\nthis.on(\"before-mount\", function () { /* do update */ })\r\n.on(\"update, function() { /* do same update */ })\r\n```\r\n\r\nIf spaced events were still supported, we could simply just do:\r\n\r\n```\r\nthis.on(\"before-mount update\", function () { /* do update */ })\r\n```\r\n\r\nNow, I agree that separating mount and update triggers was the correct decision. But I feel spaced events would be perfect for cases where I need to execute logic for both mount and update events, and its removal was untimely with this change.\r\n\r\nI could extract the update logic into a function, but for my case, it's usually a one-liner so the code just ends up duplicated across the mount and update events.\r\n\r\n4. Which version of Riot does it affect?\r\nv3.0.0 - v3.0.5\r\n\r\n5. How would you tag this issue?\r\n\r\n  - [ ] Question\r\n  - [ ] Bug\r\n  - [x] Discussion\r\n  - [x] Feature request\r\n  - [x] Tip\r\n  - [x] Enhancement\r\n  - [ ] Performance\r\n\r\n\r\nI want to thank the contributors and maintainers for working on this amazing project. I find that Riot is much friendlier to use than React and other alternatives, and its small details like these that shape the overall developer experience."},"comment":{"url":"https://api.github.com/repos/riot/riot/issues/comments/276488590","html_url":"https://github.com/riot/riot/issues/2196#issuecomment-276488590","issue_url":"https://api.github.com/repos/riot/riot/issues/2196","id":276488590,"user":{"login":"alexssung","id":2774543,"avatar_url":"https://avatars.githubusercontent.com/u/2774543?v=3","gravatar_id":"","url":"https://api.github.com/users/alexssung","html_url":"https://github.com/alexssung","followers_url":"https://api.github.com/users/alexssung/followers","following_url":"https://api.github.com/users/alexssung/following{/other_user}","gists_url":"https://api.github.com/users/alexssung/gists{/gist_id}","starred_url":"https://api.github.com/users/alexssung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexssung/subscriptions","organizations_url":"https://api.github.com/users/alexssung/orgs","repos_url":"https://api.github.com/users/alexssung/repos","events_url":"https://api.github.com/users/alexssung/events{/privacy}","received_events_url":"https://api.github.com/users/alexssung/received_events","type":"User","site_admin":false},"created_at":"2017-01-31T20:53:31Z","updated_at":"2017-01-31T20:53:31Z","body":"@rogueg \r\n\r\nAfter reading the explanation for the updates, most of them seem reasonable enough. The only change that I really still had an issue with is not being able to use refs cleanly in expressions, which you have addressed. So, thank you for taking the time to look into it!"}}
{"actor":{"display_login":"alexssung"}}