lein-figwheel

2016-09-20T01:41:26.000014Z

I have a curious problem with my Figwheel configuration. In my core namespace, I have two relevant functions:

(defn mount-root []
  (reagent/render [views/main-panel]
                  (.getElementById js/document "app")))

(defn ^:export init []
  (re-frame/dispatch-sync [:initialize-db])
  (dev-setup)
  (mount-root))
And my figwheel config is correctly set up to run only mount-root on change:
cljs.user=> (print-config dev)
{:id "dev",
 :source-paths ["src/cljc" "src/cljs"],
 :figwheel {:on-jsload "mazes.web.core/mount-root", :build-id "dev"},
(build options omitted, because that's all proven to be working)

2016-09-20T01:42:08.000015Z

And yet, whenever I change a file, it's definitely running the init function. That function is invoked in a script tag at the top of the HTML page, but I can't see why it should be invoked again.

2016-09-20T01:43:55.000017Z

...actually it's running init and then mount-root. Something's afoot.

2016-09-20T01:45:42.000018Z

🦆

2016-09-20T01:46:21.000019Z

Not sure what I did to fix this, but restarting and reloading various things was eventually enough to kick it back onto track. Glad it's working, but I don't like not knowing why.

timgilbert 2016-09-20T15:23:15.000020Z

Anyone else seeing a lot of warnings about document.write() in recent Chrome stable versions? Seems to be this: https://developers.google.com/web/updates/2016/08/removing-document-write?hl=en