 (ns frontend.devcards.morphs
-  (:require [cljs.core.async :as async :refer [<! chan]]
+  (:require [cljs.core.async :as async :refer [<! chan close!]]
             [clojure.spec :as s :include-macros true]
             [clojure.test.check.generators :as gen]
             [goog.object :as gobject]

         spec (:args (s/get-spec component-factory-var))
         samples (take sample-size (gen/sample-seq (s/gen spec overrides)))
         signature-of-sample (comp signature (partial apply shallow-render (deref component-factory-var)))
         morphs-ch (chan 1 (comp
                            (map (juxt signature-of-sample identity))
                            (distinct-by first)))]
     (async/onto-chan morphs-ch samples)
     (async/pipe morphs-ch ch))))



    (go-loop []
      (when-let [morph (<! morph-ch)]
        (om-next/update-state! this update :morphs conj morph)
        (recur)))))

(defui ^:once ^:private MorphDisplay
