From d001d765869fd2c1c08b4e31b381d1c2d2a475f5 Mon Sep 17 00:00:00 2001 From: Kimo Knowles Date: Sat, 9 Dec 2023 11:21:44 +0100 Subject: [PATCH] Fix interop issues Re-frame.utils was failing to import in a clj repl, since clj doesn't support #queue []. Fixed that, as well as some other potential compatibility problems. --- docs/releases/2023.md | 6 ++++++ src/re_frame/flow/alpha.cljc | 3 ++- src/re_frame/subs/alpha.cljc | 4 ++-- src/re_frame/utils.cljc | 5 +++-- test/re_frame/subs/{alpha_test.cljc => alpha_test.cljs} | 0 5 files changed, 13 insertions(+), 5 deletions(-) rename test/re_frame/subs/{alpha_test.cljc => alpha_test.cljs} (100%) diff --git a/docs/releases/2023.md b/docs/releases/2023.md index baccee4ea..ffd4c0760 100644 --- a/docs/releases/2023.md +++ b/docs/releases/2023.md @@ -6,6 +6,12 @@ > The re-frame [Clojars page](https://clojars.org/re-frame/) contains dependency coordinates for Maven/deps/Lein. +## 1.4.2 (2023-12-09) + +#### Fixed + + - `re-frame.utils` failed to load in a clj runtime, due to interop issues. + ## 1.4.1 (2023-12-07) #### Added diff --git a/src/re_frame/flow/alpha.cljc b/src/re_frame/flow/alpha.cljc index 8e2b0132e..bdfbc475a 100644 --- a/src/re_frame/flow/alpha.cljc +++ b/src/re_frame/flow/alpha.cljc @@ -5,6 +5,7 @@ [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.interop :as interop] [reagent.core :as r])) (def db-path? vector?) @@ -13,7 +14,7 @@ (def flow<-? (comp some? ::flow<-)) -(def flows (r/atom {})) +(def flows (interop/ratom {})) (defn lookup [id] (get @flows id)) diff --git a/src/re_frame/subs/alpha.cljc b/src/re_frame/subs/alpha.cljc index 94f2183d8..ff7dac5c5 100644 --- a/src/re_frame/subs/alpha.cljc +++ b/src/re_frame/subs/alpha.cljc @@ -4,7 +4,7 @@ [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]] - [re-frame.interop :refer [add-on-dispose! make-reaction reactive? reagent-id]] + [re-frame.interop :refer [add-on-dispose! make-reaction reactive? reagent-id ratom]] [re-frame.query.alpha :as q] [re-frame :as-alias rf] [re-frame.trace :as trace :include-macros true] @@ -102,7 +102,7 @@ (reg :sub-lifecycle :forever sub-forever) -(def nil-ref (r/atom nil)) +(def nil-ref (ratom nil)) (defn sub-flow [q] (or (some-> (:id (or (second (::rf/query-v q)) q)) diff --git a/src/re_frame/utils.cljc b/src/re_frame/utils.cljc index dd913ffc7..34a23cece 100644 --- a/src/re_frame/utils.cljc +++ b/src/re_frame/utils.cljc @@ -1,6 +1,7 @@ (ns re-frame.utils (:require - [re-frame.loggers :refer [console]])) + [re-frame.loggers :refer [console]] + [re-frame.interop :as interop])) (defn dissoc-in "Dissociates an entry from a nested associative structure returning a new @@ -53,7 +54,7 @@ {} graph) ks (keys graph)] (loop [q (filter #(zero? (get in-degree % 0)) ks) - sorted #queue [] + sorted interop/empty-queue in-degree in-degree] (cond (seq q) diff --git a/test/re_frame/subs/alpha_test.cljc b/test/re_frame/subs/alpha_test.cljs similarity index 100% rename from test/re_frame/subs/alpha_test.cljc rename to test/re_frame/subs/alpha_test.cljs