diff --git a/frontend/src/app/render_wasm/shape.cljs b/frontend/src/app/render_wasm/shape.cljs index d6e5483cbf..6a2beefd5d 100644 --- a/frontend/src/app/render_wasm/shape.cljs +++ b/frontend/src/app/render_wasm/shape.cljs @@ -6,6 +6,7 @@ (ns app.render-wasm.shape (:require + [app.common.data :as d] [app.common.data.macros :as dm] [app.common.transit :as t] [app.common.types.shape :as shape] @@ -206,12 +207,13 @@ (defn set-wasm-multi-attrs! [shape properties] (api/use-shape (:id shape)) - (let [pending + (let [result (->> properties - (mapcat #(set-wasm-single-attr! shape %)))] + (mapcat #(set-wasm-single-attr! shape %))) + pending (-> (d/index-by :key :callback result) vals)] (if (and pending (seq pending)) (->> (rx/from pending) - (rx/mapcat identity) + (rx/mapcat (fn [callback] (callback))) (rx/reduce conj []) (rx/subs! (fn [_] @@ -226,11 +228,12 @@ [shape k v] (let [shape (assoc shape k v)] (api/use-shape (:id shape)) - (let [pending (set-wasm-single-attr! shape k)] + (let [result (set-wasm-single-attr! shape k) + pending (-> (d/index-by :key :callback result) vals)] ;; TODO: set-wasm-attrs is called twice with every set (if (and pending (seq pending)) (->> (rx/from pending) - (rx/mapcat identity) + (rx/mapcat (fn [callback] (callback))) (rx/reduce conj []) (rx/subs! (fn [_]