Fork me on GitHub
#lein-figwheel
<
2016-09-20
>
amacdougall01:09:26

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)

amacdougall01:09:08

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.

amacdougall01:09:55

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

amacdougall01:09:21

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.

timgilbert15:09:15

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