0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-23 05:01:23 -05:00

🐛 Fix race condition when rendering the background color before shape tree has been initialized

This commit is contained in:
Belén Albeza 2025-01-08 11:36:26 +01:00
parent 2d955a2256
commit 3d370de49e

View file

@ -284,8 +284,7 @@
(p/fmap (fn [ready?]
(when ready?
(reset! canvas-init? true)
(wasm.api/assign-canvas canvas)
(wasm.api/set-canvas-background background)))))
(wasm.api/assign-canvas canvas)))))
(fn []
(wasm.api/clear-canvas))))
@ -293,15 +292,15 @@
(when @canvas-init?
(wasm.api/resize-viewbox (:width vport) (:height vport))))
(mf/with-effect [base-objects canvas-init?]
(mf/with-effect [base-objects @canvas-init?]
(when @canvas-init?
(wasm.api/set-objects base-objects)))
(mf/with-effect [preview-blend canvas-init?]
(mf/with-effect [preview-blend @canvas-init?]
(when (and @canvas-init? preview-blend)
(wasm.api/request-render)))
(mf/with-effect [vbox canvas-init?]
(mf/with-effect [vbox @canvas-init?]
(when @canvas-init?
(wasm.api/set-view zoom vbox)))