🐛 Avoid race condition in initialize-workspace

This commit is contained in:
Belén Albeza 2026-04-24 09:59:31 +02:00
parent 50bc7439f4
commit f7301396d0
3 changed files with 9 additions and 6 deletions

View File

@ -75,6 +75,7 @@
[app.main.store :as st]
[app.render-wasm :as wasm]
[app.render-wasm.api :as wasm.api]
[app.render-wasm.wasm :as wasm-state]
[app.util.dom :as dom]
[app.util.globals :as ug]
[app.util.http :as http]
@ -319,7 +320,10 @@
(let [stoper-s (rx/filter (ptk/type? ::finalize-workspace) stream)
rparams (rt/get-params state)
features (features/get-enabled-features state team-id)
render-wasm? #(features/active-feature? @st/state "render-wasm/v1")]
render-wasm-enabled? #(features/active-feature? @st/state "render-wasm/v1")
render-wasm-ready? #(and (render-wasm-enabled?)
wasm-state/context-initialized?
(not @wasm-state/context-lost?))]
(log/debug :hint "initialize-workspace"
:team-id (dm/str team-id)
@ -330,7 +334,7 @@
(rx/concat
;; Fetch all essential data that should be loaded before the file
(rx/merge
(if ^boolean (render-wasm?)
(if ^boolean (render-wasm-enabled?)
(->> (rx/from @wasm/module)
(rx/filter true?)
(rx/tap (fn [_]
@ -408,7 +412,7 @@
(->> stream
(rx/filter dch/commit?)
(rx/filter (fn [_] (render-wasm?)))
(rx/filter (fn [_] (render-wasm-ready?)))
(rx/map deref)
(rx/mapcat
(fn [{:keys [redo-changes]}]
@ -421,7 +425,7 @@
(let [local-commits-s
(->> stream
(rx/filter dch/commit?)
(rx/filter (fn [_] (render-wasm?)))
(rx/filter (fn [_] (render-wasm-ready?)))
(rx/map deref)
(rx/filter #(and (= :local (:source %))
(not (contains? (:tags %) :position-data))))

View File

@ -31,7 +31,6 @@
[app.main.ui.workspace.viewport.utils :as utils]
[app.main.worker :as mw]
[app.render-wasm.api :as wasm.api]
[app.render-wasm.wasm :as wasm]
[app.util.debug :as dbg]
[app.util.dom :as dom]
[app.util.globals :as globals]

View File

@ -1166,7 +1166,7 @@ msgid "dashboard.webgl-switch.beta"
msgstr "Beta"
msgid "dashboard.webgl-switch.description"
msgstr "WebGL rendering can improve performance, but it is in beta and may be less stable. Some visual differences may appear between the canvas, exports (SVG/PDF), and view mode."
msgstr "WebGL rendering can improve performance, but it is in beta and may be less stable. Some visual differences may appear between the canvas, exports (SVG/PDF), and view mode."
msgid "dashboard.webgl-switch.status"
msgstr "Status"