diff --git a/examples/frontend-re-frame/project.clj b/examples/frontend-re-frame/project.clj index 88819135..1d5422b0 100644 --- a/examples/frontend-re-frame/project.clj +++ b/examples/frontend-re-frame/project.clj @@ -33,7 +33,7 @@ {:builds [{:id "dev" :source-paths ["src/cljs"] - :figwheel {:on-jsload "frontend-re-frame.core/mount-root"} + :figwheel true :compiler {:main frontend-re-frame.core :output-to "resources/public/js/compiled/app.js" :output-dir "resources/public/js/compiled/out" diff --git a/examples/frontend-re-frame/resources/public/index.html b/examples/frontend-re-frame/resources/public/index.html index c17ffaac..be5fed2a 100644 --- a/examples/frontend-re-frame/resources/public/index.html +++ b/examples/frontend-re-frame/resources/public/index.html @@ -2,12 +2,9 @@
- - - diff --git a/examples/frontend-re-frame/src/cljs/frontend_re_frame/core.cljs b/examples/frontend-re-frame/src/cljs/frontend_re_frame/core.cljs index 0da5910c..e0b4c10d 100644 --- a/examples/frontend-re-frame/src/cljs/frontend_re_frame/core.cljs +++ b/examples/frontend-re-frame/src/cljs/frontend_re_frame/core.cljs @@ -11,8 +11,10 @@ (re-frame/reg-event-db ::initialize-db - (fn [_ _] - {:current-route nil})) + (fn [db _] + (if db + db + {:current-route nil}))) (re-frame/reg-event-fx ::navigate @@ -141,13 +143,12 @@ (enable-console-print!) (println "dev mode"))) -(defn mount-root [] +(defn init [] (re-frame/clear-subscription-cache!) + (re-frame/dispatch-sync [::initialize-db]) + (dev-setup) (init-routes!) ;; Reset routes on figwheel reload (reagent/render [router-component {:router router}] (.getElementById js/document "app"))) -(defn ^:export init [] - (re-frame/dispatch-sync [::initialize-db]) - (dev-setup) - (mount-root)) +(init)