{"action":"created","issue":{"url":"https://api.github.com/repos/reagent-project/reagent/issues/153","labels_url":"https://api.github.com/repos/reagent-project/reagent/issues/153/labels{/name}","comments_url":"https://api.github.com/repos/reagent-project/reagent/issues/153/comments","events_url":"https://api.github.com/repos/reagent-project/reagent/issues/153/events","html_url":"https://github.com/reagent-project/reagent/issues/153","id":92375666,"number":153,"title":"Help re-rendering application using figwheel","user":{"login":"joakin","id":657839,"avatar_url":"https://avatars.githubusercontent.com/u/657839?v=3","gravatar_id":"","url":"https://api.github.com/users/joakin","html_url":"https://github.com/joakin","followers_url":"https://api.github.com/users/joakin/followers","following_url":"https://api.github.com/users/joakin/following{/other_user}","gists_url":"https://api.github.com/users/joakin/gists{/gist_id}","starred_url":"https://api.github.com/users/joakin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joakin/subscriptions","organizations_url":"https://api.github.com/users/joakin/orgs","repos_url":"https://api.github.com/users/joakin/repos","events_url":"https://api.github.com/users/joakin/events{/privacy}","received_events_url":"https://api.github.com/users/joakin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-07-01T12:58:18Z","updated_at":"2015-07-07T09:18:38Z","closed_at":"2015-07-07T09:00:12Z","body":"Hi!\r\n\r\nI've been working on migrating a hackathon project to clojurescript using reagent https://github.com/joakin/webkipedia\r\n\r\nThe problem I'm hitting is that figwheel reloads do not trigger a full re-render of the webapp, and I'm not sure why.\r\n\r\nThis is where the figwheel reload calls: https://github.com/joakin/webkipedia/blob/master/src/webkipedia/core.cljs#L9-L20\r\n\r\n```clojure\r\n(defn render! []\r\n  (reagent/render-component [webkipedia]\r\n                            (.-body js/document)))\r\n\r\n(render!)\r\n(router/init)\r\n\r\n(defn on-js-reload []\r\n  ;; optionally touch your app-state to force rerendering depending on\r\n  ;; your application\r\n  (render!)\r\n)\r\n```\r\n\r\nI've been trying the solutions proposed in #94 but neither `[#'webkipedia]` nor calling `reagent/force-update-all` in `on-js-reload` seem to help me out.\r\n\r\nTo try out if the the re-rendering I'm changing the main title here https://github.com/joakin/webkipedia/blob/master/src/webkipedia/ui/main_page.cljs#L11\r\n\r\nAny ideas on what I'm doing wrong or how could I circle the issue?\r\n\r\nThanks a lot for your work on reagent, it is a pleasure to use."},"comment":{"url":"https://api.github.com/repos/reagent-project/reagent/issues/comments/119134477","html_url":"https://github.com/reagent-project/reagent/issues/153#issuecomment-119134477","issue_url":"https://api.github.com/repos/reagent-project/reagent/issues/153","id":119134477,"user":{"login":"JulianLeviston","id":5661934,"avatar_url":"https://avatars.githubusercontent.com/u/5661934?v=3","gravatar_id":"","url":"https://api.github.com/users/JulianLeviston","html_url":"https://github.com/JulianLeviston","followers_url":"https://api.github.com/users/JulianLeviston/followers","following_url":"https://api.github.com/users/JulianLeviston/following{/other_user}","gists_url":"https://api.github.com/users/JulianLeviston/gists{/gist_id}","starred_url":"https://api.github.com/users/JulianLeviston/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JulianLeviston/subscriptions","organizations_url":"https://api.github.com/users/JulianLeviston/orgs","repos_url":"https://api.github.com/users/JulianLeviston/repos","events_url":"https://api.github.com/users/JulianLeviston/events{/privacy}","received_events_url":"https://api.github.com/users/JulianLeviston/received_events","type":"User","site_admin":false},"created_at":"2015-07-07T09:18:38Z","updated_at":"2015-07-07T09:18:38Z","body":"I recommend reading more about figwheel at the figwheel repo, and looking under the hood.\r\n\r\nReagent in combo with figwheel uses function replacement, which causes a re-render but only of the functions that change. This also happens when Reagent builds a reaction - as happens anytime you use a dereffed atom or cursor, from what I understand. This will cause a re-render on atom/cursor modification.\r\n\r\nSo, every time you save, and figwheel reloads the code, what you *were* doing is re-evaluating the refs to the functions which means it had to reload the whole tree - it had no choice because it couldn't tell if the functions had changed or not. Using that strategy, figwheel can't actually do anything other than get react to reload everything.\r\n\r\nThis is also the reason we use defonce around atoms when building \"live-reloadable code\"... because each time you save, figwheel will reload the refs, so if you have atoms defined with def they would get re-deffed, which would cause everything to reload from scratch the same as when you were using #' everywhere.\r\n\r\nHope that helps you understand more what's happening."}}