diff --git a/src/reagent/ratom.clj b/src/reagent/ratom.clj index 2acaaa5..2758871 100644 --- a/src/reagent/ratom.clj +++ b/src/reagent/ratom.clj @@ -13,7 +13,7 @@ (deref co#) co#)) -(defmacro with-kept [bindings & body] +(defmacro with-let [bindings & body] (assert (vector? bindings)) (let [v (gensym "bind-v") bs (->> bindings @@ -37,7 +37,7 @@ (when (== (.-ratomGeneration c#) (.-generation ~v)) (js/console.error - "The same with-kept is being used more than once in the + "The same with-let is being used more than once in the same reactive context.")) (set! (.-generation ~v) (.-ratomGeneration c#)))) (let ~bs diff --git a/test/reagenttest/testreagent.cljs b/test/reagenttest/testreagent.cljs index 718b052..b588e28 100644 --- a/test/reagenttest/testreagent.cljs +++ b/test/reagenttest/testreagent.cljs @@ -1,6 +1,6 @@ (ns reagenttest.testreagent (:require [cljs.test :as t :refer-macros [is deftest testing]] - [reagent.ratom :as rv :refer-macros [reaction]] + [reagent.ratom :as rv :refer-macros [reaction with-let]] [reagent.debug :refer-macros [dbg println log]] [reagent.interop :refer-macros [.' .!]] [reagent.core :as r])) @@ -565,3 +565,23 @@ c2 (fn [] [c1 (sorted-map 1 "foo" 2 "bar")])] (is (= (rstr [c2]) "