{"action":"created","issue":{"url":"https://api.github.com/repos/riot/riot/issues/2095","repository_url":"https://api.github.com/repos/riot/riot","labels_url":"https://api.github.com/repos/riot/riot/issues/2095/labels{/name}","comments_url":"https://api.github.com/repos/riot/riot/issues/2095/comments","events_url":"https://api.github.com/repos/riot/riot/issues/2095/events","html_url":"https://github.com/riot/riot/pull/2095","id":191780075,"number":2095,"title":"Add hot reloading","user":{"login":"rogueg","id":1145907,"avatar_url":"https://avatars.githubusercontent.com/u/1145907?v=3","gravatar_id":"","url":"https://api.github.com/users/rogueg","html_url":"https://github.com/rogueg","followers_url":"https://api.github.com/users/rogueg/followers","following_url":"https://api.github.com/users/rogueg/following{/other_user}","gists_url":"https://api.github.com/users/rogueg/gists{/gist_id}","starred_url":"https://api.github.com/users/rogueg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rogueg/subscriptions","organizations_url":"https://api.github.com/users/rogueg/orgs","repos_url":"https://api.github.com/users/rogueg/repos","events_url":"https://api.github.com/users/rogueg/events{/privacy}","received_events_url":"https://api.github.com/users/rogueg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2016-11-26T01:26:51Z","updated_at":"2016-12-22T08:02:02Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/riot/riot/pulls/2095","html_url":"https://github.com/riot/riot/pull/2095","diff_url":"https://github.com/riot/riot/pull/2095.diff","patch_url":"https://github.com/riot/riot/pull/2095.patch"},"body":"When a tag gets re-defined (eg `riot.tag2`), the hot reloader looks through DOM, finds every instance of that tag, and replaces it.\r\n\r\nReplacing tags goes through the full lifecycle: the old instance is un-mounted, and the new instance calls the constructor and mount callbacks. Hot reloading will preserve the tag's original attributes, yields, and state.\r\n\r\nIf you need to do anything custom before or after the reload, you can use the callbacks:\r\n```\r\nriot.util.hotReloader.on('before-unmount', () => /* some cleanup */)\r\nriot.util.hotReloader.on('after-mount', () => /* some setup */)\r\n```\r\nThis is useful when you have 3rd party libraries that do DOM manipulation.\r\n\r\nHere's a gist on using it with Gulp:\r\nhttps://gist.github.com/rogueg/4d48d32bd678aba784455ef8685c4494"},"comment":{"url":"https://api.github.com/repos/riot/riot/issues/comments/268741440","html_url":"https://github.com/riot/riot/pull/2095#issuecomment-268741440","issue_url":"https://api.github.com/repos/riot/riot/issues/2095","id":268741440,"user":{"login":"rogueg","id":1145907,"avatar_url":"https://avatars.githubusercontent.com/u/1145907?v=3","gravatar_id":"","url":"https://api.github.com/users/rogueg","html_url":"https://github.com/rogueg","followers_url":"https://api.github.com/users/rogueg/followers","following_url":"https://api.github.com/users/rogueg/following{/other_user}","gists_url":"https://api.github.com/users/rogueg/gists{/gist_id}","starred_url":"https://api.github.com/users/rogueg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rogueg/subscriptions","organizations_url":"https://api.github.com/users/rogueg/orgs","repos_url":"https://api.github.com/users/rogueg/repos","events_url":"https://api.github.com/users/rogueg/events{/privacy}","received_events_url":"https://api.github.com/users/rogueg/received_events","type":"User","site_admin":false},"created_at":"2016-12-22T08:02:02Z","updated_at":"2016-12-22T08:02:02Z","body":"It's working as intended. `this.message` is state, and we preserve it across a hot-reload. If you imagine that `message` was something we entered in a text field, it makes sense why we'd want to keep it.\r\n\r\nMy understanding is that React and Vue do the same thing."}}
{"actor":{"display_login":"rogueg"}}