Merge pull request #144 from drapanjanas/fix-double-init-of-figwheel

fix double initialization of figwheel
This commit is contained in:
Artūr Girenko 2017-10-08 18:27:31 +02:00 committed by GitHub
commit 181a208058
5 changed files with 29 additions and 29 deletions

View File

@ -2,17 +2,17 @@
(:require [om.next :as om]
[$PROJECT_NAME_HYPHENATED$.$PLATFORM$.core :as core]
[$PROJECT_NAME_HYPHENATED$.state :as state]
[figwheel.client :as figwheel :include-macros true]))
[figwheel.client :as fw]))
(enable-console-print!)
(assert (exists? core/init) "Fatal Error - Your core.cljs file doesn't define an 'init' function!!! - Perhaps there was a compilation failure?")
(assert (exists? core/app-root) "Fatal Error - Your core.cljs file doesn't define an 'app-root' function!!! - Perhaps there was a compilation failure?")
(figwheel/watch-and-reload
:websocket-url "ws://localhost:3449/figwheel-ws"
(fw/start {
:websocket-url "ws://$DEV_HOST$:3449/figwheel-ws"
:heads-up-display false
:jsload-callback #(om/add-root! state/reconciler core/AppRoot 1))
:jsload-callback #(om/add-root! state/reconciler core/AppRoot 1)})
(core/init)

View File

@ -1,9 +1,9 @@
(ns ^:figwheel-no-load env.$PLATFORM$.main
(ns ^:figwheel-no-load env.$PLATFORM$.main
(:require [reagent.core :as r]
[$PROJECT_NAME_HYPHENATED$.$PLATFORM$.core :as core]
[figwheel.client :as figwheel :include-macros true]))
[figwheel.client :as fw]))
(enable-console-print!)
(enable-console-print!)
(assert (exists? core/init) "Fatal Error - Your core.cljs file doesn't define an 'init' function!!! - Perhaps there was a compilation failure?")
(assert (exists? core/app-root) "Fatal Error - Your core.cljs file doesn't define an 'app-root' function!!! - Perhaps there was a compilation failure?")
@ -14,9 +14,9 @@
;; Do not delete, root-el is used by the figwheel-bridge.js
(def root-el (r/as-element [reloader]))
(figwheel/watch-and-reload
(fw/start {
:websocket-url "ws://$DEV_HOST$:3449/figwheel-ws"
:heads-up-display false
:jsload-callback #(swap! cnt inc))
:jsload-callback #(swap! cnt inc)})
(core/init)

View File

@ -1,10 +1,10 @@
(ns ^:figwheel-no-load env.$PLATFORM$.main
(ns ^:figwheel-no-load env.$PLATFORM$.main
(:require [reagent.core :as r]
[re-frame.core :refer [clear-subscription-cache!]]
[$PROJECT_NAME_HYPHENATED$.$PLATFORM$.core :as core]
[figwheel.client :as figwheel :include-macros true]))
[figwheel.client :as fw]))
(enable-console-print!)
(enable-console-print!)
(assert (exists? core/init) "Fatal Error - Your core.cljs file doesn't define an 'init' function!!! - Perhaps there was a compilation failure?")
(assert (exists? core/app-root) "Fatal Error - Your core.cljs file doesn't define an 'app-root' function!!! - Perhaps there was a compilation failure?")
@ -19,9 +19,9 @@
(clear-subscription-cache!)
(swap! cnt inc))
(figwheel/watch-and-reload
(fw/start {
:websocket-url "ws://$DEV_HOST$:3449/figwheel-ws"
:heads-up-display false
:jsload-callback force-reload!)
:jsload-callback force-reload!})
(core/init)

View File

@ -1,6 +1,6 @@
(ns ^:figwheel-no-load env.$PLATFORM$.main
(:require [$PROJECT_NAME_HYPHENATED$.$PLATFORM$.core :as core]
[figwheel.client :as figwheel :include-macros true]))
[figwheel.client :as fw]))
(assert (exists? core/init) "Fatal Error - Your core.cljs file doesn't define an 'init' function!!! - Perhaps there was a compilation failure?")
(assert (exists? core/root-component-factory) "Fatal Error - Your core.cljs file doesn't define an 'root-component-factory' function!!! - Perhaps there was a compilation failure?")
@ -8,11 +8,11 @@
(enable-console-print!)
(figwheel/watch-and-reload
:websocket-url "ws://localhost:3449/figwheel-ws"
(fw/start {
:websocket-url "ws://$DEV_HOST$:3449/figwheel-ws"
:heads-up-display false
;; TODO make this Rum something
:jsload-callback #(#'core/mount-app))
:jsload-callback #(#'core/mount-app)})
(core/init)

View File

@ -190,7 +190,7 @@ function loadApp(platform, devHost, onLoadCb) {
var fileBasePath = serverBaseUrl((isChrome() ? "localhost" : devHost)) + "/" + config.basePath + platform;
// callback when app is ready to get the reloadable component
var mainJs = '/figwheel/connect/build_' + platform + '.js';
var mainJs = `/env/${platform}/main.js`;
evalListeners.waitForFinalEval = function (url) {
if (url.indexOf(mainJs) > -1) {
assertRootElExists(platform);
@ -212,7 +212,7 @@ function loadApp(platform, devHost, onLoadCb) {
// seriously React packager? why.
var googreq = goog.require;
googreq('figwheel.connect.build_' + platform);
googreq(`env.${platform}.main`);
});
});
}