lein_template_descjop icon indicating copy to clipboard operation
lein_template_descjop copied to clipboard

`:jsload-callback` should call core/mount-root instead of start-descjop!

Open gadfly361 opened this issue 6 years ago • 2 comments

Hey, I think there is a subtle bug in the profile dev init files.

The :jsload-callback (effectively) calls core/init!; however, it should instead call core/mount-root. This is an important distinction, because the core/init! function should run things once when the application first loads, and core/mount-root should be called every time figwheel reloads.


Bug is here: https://github.com/karad/lein_template_descjop/blob/master/resources/leiningen/new/descjop/reagent__src__front__profile__dev__init.cljs#L10

:jsload-callback should instead call mount-root: https://github.com/karad/lein_template_descjop/blob/master/resources/leiningen/new/descjop/reagent__src__front__core.cljs#L10

gadfly361 avatar May 16 '18 12:05 gadfly361

Thank you! I will check the bug, and try to fix if it has probrem.

karad avatar May 16 '18 22:05 karad

@karad Upon further inspection, this line here will also be problematic and I think it should likely be removed.

That line will effectively call the core/init! function on every figwheel reload because it is a direct function call in a namespace. A way around this is to instead call the core/init! function from your index.html file. You could do that by adding a line here with the core/init! function call.

An example of how to make such a function call from an index.html file can be seen here, which references this function here

gadfly361 avatar May 16 '18 22:05 gadfly361