0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 07:29:08 -05:00

🐛 Fix problem with font loading

This commit is contained in:
alonso.torres 2024-01-09 17:10:12 +01:00 committed by Andrey Antukh
parent a4796e8db8
commit 9c35652043

View file

@ -211,7 +211,7 @@
;; Font is currently downloading. We attach the caller to the promise ;; Font is currently downloading. We attach the caller to the promise
(contains? @loading font-id) (contains? @loading font-id)
(p/resolved (get @loading font-id)) (get @loading font-id)
;; First caller, we create the promise and then wait ;; First caller, we create the promise and then wait
:else :else
@ -220,13 +220,13 @@
(swap! loading dissoc font-id) (swap! loading dissoc font-id)
(resolve font-id)) (resolve font-id))
load-p (->> (p/create load-p (-> (p/create
(fn [resolve _] (fn [resolve _]
(-> font (-> font
(assoc ::on-loaded (partial on-load resolve)) (assoc ::on-loaded (partial on-load resolve))
(load-font)))) (load-font))))
;; We need to wait for the font to be loaded ;; We need to wait for the font to be loaded
(p/delay 120))] (p/then (partial p/delay 120)))]
(swap! loading assoc font-id load-p) (swap! loading assoc font-id load-p)
load-p)))))) load-p))))))