🔧 Wait for first render using a custom event (visual regression tests)

This commit is contained in:
Belén Albeza 2025-06-09 14:51:25 +02:00
parent 59a4b51d2c
commit 1a10b7ebfd
4 changed files with 25 additions and 14 deletions

View file

@ -766,13 +766,17 @@
(defn process-pending
[pending]
(when-let [pending (-> (d/index-by :key :callback pending) vals)]
(->> (rx/from pending)
(rx/mapcat (fn [callback] (callback)))
(rx/reduce conj [])
(rx/subs! (fn [_]
(clear-drawing-cache)
(request-render "set-objects"))))))
(let [event (js/CustomEvent. "wasm:set-objects-finished")
pending (-> (d/index-by :key :callback pending) vals)]
(if (not-empty? pending)
(->> (rx/from pending)
(rx/mapcat (fn [callback] (callback)))
(rx/reduce conj [])
(rx/subs! (fn [_]
(clear-drawing-cache)
(request-render "set-objects")
(.dispatchEvent ^js js/document event))))
(.dispatchEvent ^js js/document event))))
(defn process-object
[shape]