🐛 Fix asynchronous content dependant rendering (#6142)

* 🐛 Fix custom fonts rendering

* 🐛 Fix asynchronous content dependant rendering

* 🎉 Renaming clear_cache to clear_drawing_cache
This commit is contained in:
Alejandro 2025-03-25 09:49:47 +01:00 committed by GitHub
parent 9653e72e47
commit 065b50f5a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 10 deletions

View file

@ -777,8 +777,8 @@
(h/call internal-module "_set_view" zoom (- (:x vbox)) (- (:y vbox)))
(render nil))
(defn clear-cache []
(h/call internal-module "_clear_cache"))
(defn clear-drawing-cache []
(h/call internal-module "_clear_drawing_cache"))
(defn- store-all-fonts
[fonts]
@ -803,7 +803,9 @@
(->> (rx/from pending)
(rx/mapcat identity)
(rx/reduce conj [])
(rx/subs! request-render))))
(rx/subs! (fn [_]
(clear-drawing-cache)
(request-render "set-fonts"))))))
(defn set-objects
[objects]
@ -886,13 +888,15 @@
(let [pending' (concat (set-shape-fills fills) (set-shape-strokes strokes))]
(recur (inc index) (into pending pending'))))
pending))]
(clear-cache)
(clear-drawing-cache)
(request-render "set-objects")
(when-let [pending (seq pending)]
(->> (rx/from pending)
(rx/mapcat identity)
(rx/reduce conj [])
(rx/subs! request-render)))))
(rx/subs! (fn [_]
(clear-drawing-cache)
(request-render "set-objects")))))))
(defn uuid->u8
[id]

View file

@ -145,7 +145,7 @@
;; when something synced with wasm
;; is modified, we need to request
;; a new render.
(api/clear-cache)
(api/clear-drawing-cache)
(api/request-render "set-wasm-attrs")))
(defn- impl-assoc