🐛 Fix errors in thumbnails

This commit is contained in:
alonso.torres 2026-04-21 15:35:06 +02:00
parent c636517499
commit 2901d00862
3 changed files with 7 additions and 3 deletions

View File

@ -334,7 +334,7 @@
(defn request-render
[_requester]
(when (and wasm/context-initialized? (not @wasm/context-lost?))
(when (and wasm/context-initialized? (not @wasm/context-lost?) (not @wasm/disable-request-render?))
(if @shapes-loading?
(register-deferred-render!)
(when-not @pending-render
@ -1698,6 +1698,8 @@
[]
(when wasm/context-initialized?
(try
(set! wasm/context-initialized? false)
;; Cancel any pending animation frame to prevent race conditions
(when wasm/internal-frame-id
(js/cancelAnimationFrame wasm/internal-frame-id)
@ -1708,8 +1710,6 @@
(reset! shapes-loading? false)
(reset! deferred-render? false)
;; TODO: perform corresponding cleaning
(set! wasm/context-initialized? false)
(h/call wasm/internal-module "_clean_up")
;; Remove event listener for WebGL context lost

View File

@ -26,6 +26,9 @@
(defonce context-initialized? false)
(defonce context-lost? (atom false))
;; When we're rendering in a sync way we want to stop the asynchrous `request-render`
(defonce disable-request-render? (atom false))
(defonce serializers
#js {:blur-type shared/RawBlurType

View File

@ -170,6 +170,7 @@
(render/calculate-dimensions objects thumbnail-aspect-ratio))
zoom (/ width (:width vbox))]
(reset! wasm/disable-request-render? true)
(wasm.api/initialize-viewport
objects zoom vbox
:background bgcolor