Closed yatesco closed 9 years ago
:+1: I'm getting this as well.
Tested in Chrome.
I did notice that this message disappears when I pass in a function instead of a vector.
(r/render-component [:h2 "doesn't work"] (.getElementById js/document "app"))
(r/render-component [(fn [] [:h2 "works"])] (.getElementById js/document "app"))
Turns out the problem is with the code here:
(secretary/defroute "/" []
(session/put! :current-page home-page))
(secretary/defroute "/about" []
(session/put! :current-page about-page))
The variable referring to the page ends up being bound in a namespace that's not refreshed, so when changes are pushed the stale variable is still in use. using a function gets around the problem.
In the next release of ClojureScript it'll be possible to do the following to get around the problem:
(secretary/defroute "/" []
(session/put! :current-page #'home-page))
(secretary/defroute "/about" []
(session/put! :current-page #'about-page))
Using (fn [] )
as @escherize doing is another way to get around that.
updated the template to latest ClojureScript and added the fix for reloading.
I am getting this now. How to fix it ????
This should work as long as the top level components that are being reloaded are referenced using #'
or wrapped using (fn [] )
. I'm not able to reproduce the issue using the latest template.
Also make sure the file that does your defroute has
^:figwheel-always
in the namespace.
When making a change in a cljs file figwheel compiles it, states
notifying browser that file changed: ...
but the browser ignores the latest and throws a warning:Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.
Steps to reproduce:
lein new reagent reagent-test
cd reagent-test
lein ring server
lein repl
(start-figwheel)
The behaviour is the same regardless of whether the browser-repl is started and attached to the browser.
Tested in latest Chromium and Firefox.