Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gadfly361 opened this issue May 16, 2018 · 2 comments
Open

Comments

@gadfly361
Copy link

gadfly361 commented May 16, 2018

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

@karad
Copy link
Owner

karad commented May 16, 2018

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

@gadfly361
Copy link
Author

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants