{"action":"created","issue":{"url":"https://api.github.com/repos/lhorie/mithril.js/issues/1117","repository_url":"https://api.github.com/repos/lhorie/mithril.js","labels_url":"https://api.github.com/repos/lhorie/mithril.js/issues/1117/labels{/name}","comments_url":"https://api.github.com/repos/lhorie/mithril.js/issues/1117/comments","events_url":"https://api.github.com/repos/lhorie/mithril.js/issues/1117/events","html_url":"https://github.com/lhorie/mithril.js/pull/1117","id":161018318,"number":1117,"title":"Remove unloaders when root element is removed","user":{"login":"epidemian","id":722544,"avatar_url":"https://avatars.githubusercontent.com/u/722544?v=3","gravatar_id":"","url":"https://api.github.com/users/epidemian","html_url":"https://github.com/epidemian","followers_url":"https://api.github.com/users/epidemian/followers","following_url":"https://api.github.com/users/epidemian/following{/other_user}","gists_url":"https://api.github.com/users/epidemian/gists{/gist_id}","starred_url":"https://api.github.com/users/epidemian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/epidemian/subscriptions","organizations_url":"https://api.github.com/users/epidemian/orgs","repos_url":"https://api.github.com/users/epidemian/repos","events_url":"https://api.github.com/users/epidemian/events{/privacy}","received_events_url":"https://api.github.com/users/epidemian/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-18T10:43:35Z","updated_at":"2016-06-18T19:34:53Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/lhorie/mithril.js/pulls/1117","html_url":"https://github.com/lhorie/mithril.js/pull/1117","diff_url":"https://github.com/lhorie/mithril.js/pull/1117.diff","patch_url":"https://github.com/lhorie/mithril.js/pull/1117.patch"},"body":"Hi! I stumbled upon this when trying to make a test for #1091 work.\r\n\r\nPlease take into account that i'm not familiarized at all with the Mithril codebase, so this proposed \"fix\" for the pending tests could totally be a nonsensical screwup!  :sweat_smile: \r\n\r\n---\r\n\r\nWhen a controller calls preventDefault on its onunload method, it prevents the current root element from being unmounted via a route change. But it does not prevent it from being unmounted via m.mount(root, null). In that case, the root element is unmounted, but any unloaders that it had keep hanging on the `unloaders` array, and that prevented any future m.mount(root, component) calls from succeeding. This is what was happening on the pending route() tests.\r\n\r\nThe fix is pretty simple: just reset the `unloaders` array when removing the root element, just like it's done when no unloader calls preventDefault.\r\n\r\nAlso, 2 of the 4 pending tests were removed because they were identical to the other 2."},"comment":{"url":"https://api.github.com/repos/lhorie/mithril.js/issues/comments/226960957","html_url":"https://github.com/lhorie/mithril.js/pull/1117#issuecomment-226960957","issue_url":"https://api.github.com/repos/lhorie/mithril.js/issues/1117","id":226960957,"user":{"login":"isiahmeadows","id":4483844,"avatar_url":"https://avatars.githubusercontent.com/u/4483844?v=3","gravatar_id":"","url":"https://api.github.com/users/isiahmeadows","html_url":"https://github.com/isiahmeadows","followers_url":"https://api.github.com/users/isiahmeadows/followers","following_url":"https://api.github.com/users/isiahmeadows/following{/other_user}","gists_url":"https://api.github.com/users/isiahmeadows/gists{/gist_id}","starred_url":"https://api.github.com/users/isiahmeadows/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isiahmeadows/subscriptions","organizations_url":"https://api.github.com/users/isiahmeadows/orgs","repos_url":"https://api.github.com/users/isiahmeadows/repos","events_url":"https://api.github.com/users/isiahmeadows/events{/privacy}","received_events_url":"https://api.github.com/users/isiahmeadows/received_events","type":"User","site_admin":false},"created_at":"2016-06-18T19:34:53Z","updated_at":"2016-06-18T19:34:53Z","body":"Thank you! I tried for about a month straight intermittently trying to pin down why these tests were failing a while back, and just couldn't pin down the source of the bug.\r\n\r\nOh, and I didn't realize the tests were identical. It's easy to overlook that when so many of the tests are just minor variations of each other."}}
{"actor":{"display_login":"isiahmeadows"}}