Skip to content

Commit

Permalink
Fix cljc compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
kimo-k committed Jan 26, 2024
1 parent 757432a commit 39b27c8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
14 changes: 8 additions & 6 deletions src/re_frame/flow/alpha.cljc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
(ns re-frame.flow.alpha
(:require
[re-frame.db :as db]
#?(:cljs [re-frame.db :as db])
[re-frame.utils :as u]
[re-frame.registrar :refer [get-handler]]
[re-frame.loggers :refer [console]]
[re-frame.interceptor :refer [->interceptor get-effect get-coeffect update-effect assoc-effect]]
[re-frame.interceptor :refer [->interceptor get-effect get-coeffect assoc-effect]]
[re-frame.interop :as interop]
[reagent.core :as r]))
#?(:cljs [reagent.core :as r])))

(def db-path? vector?)

Expand Down Expand Up @@ -58,7 +58,7 @@
(defn validate-inputs [{:keys [inputs]}]
(doseq [[_ input] inputs
:when (not ((some-fn db-path? flow<-?) input))]
(throw (js/Error. "bad input"))))
(throw (#?(:clj Exception. :cljs js/Error.) "bad input"))))

(defn warn-stale-dependencies [flows new-flow]
(let [ins (stale-in-flows flows new-flow)
Expand Down Expand Up @@ -91,8 +91,10 @@
(warn-stale-dependencies @flows m)
(swap! flows assoc
(:id m) (with-meta (merge (default (:id m)) m)
{::new? true
::ref (r/reaction (get-in @db/app-db (:path m)))}))))
(merge
{::new? true}
#?(:cljs
{::ref (r/reaction (get-in @db/app-db (:path m)))}))))))

(defn clear-flow
([]
Expand Down
1 change: 0 additions & 1 deletion src/re_frame/subs/alpha.cljc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(ns re-frame.subs.alpha
(:require
[reagent.core :as r]
[re-frame.subs :refer [deref-input-signals sugar warn-when-not-reactive]]
[re-frame.registrar :refer [register-handler]]
[re-frame.register.alpha :refer [reg lifecycle->method]]
Expand Down
2 changes: 1 addition & 1 deletion test/re_frame/flow/alpha_test.cljc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(ns re-frame.flow.alpha-test
(:require
[cljs.test :refer [is deftest async use-fixtures testing]]
[cljs.test :refer [is deftest use-fixtures testing]]
[re-frame.alpha :as rf]
[re-frame.flow.alpha :as f]
[re-frame.db :refer [app-db]]))
Expand Down

0 comments on commit 39b27c8

Please sign in to comment.