mirror of
https://github.com/penpot/penpot.git
synced 2025-02-01 11:59:17 -05:00
✨ Disable wasm loading if feature is disabled
This commit is contained in:
parent
b17d7c0289
commit
1de35b2e3a
3 changed files with 42 additions and 37 deletions
|
@ -127,7 +127,7 @@
|
|||
|
||||
ptk/WatchEvent
|
||||
(watch [_ _ stream]
|
||||
(let [stopper (rx/filter (ptk/type? ::finalize) stream)]
|
||||
(let [stopper (rx/filter (ptk/type? ::finalize-team) stream)]
|
||||
(->> (rx/merge
|
||||
(rx/of (fetch-teams))
|
||||
(->> stream
|
||||
|
|
|
@ -267,7 +267,8 @@
|
|||
[project-id file-id]
|
||||
(ptk/reify ::fetch-bundle-stage-1
|
||||
ptk/WatchEvent
|
||||
(watch [_ _ stream]
|
||||
(watch [_ state stream]
|
||||
(let [render-wasm? (features/active-feature? state "render-wasm/v1")]
|
||||
(->> (rp/cmd! :get-project {:id project-id})
|
||||
(rx/mapcat (fn [project]
|
||||
(rx/concat
|
||||
|
@ -275,8 +276,11 @@
|
|||
;; load. We need to wait the promise to be resolved
|
||||
;; before continue with the next workspace loading
|
||||
;; steps
|
||||
(->> (rx/from wasm/module)
|
||||
|
||||
(if ^boolean render-wasm?
|
||||
(->> (rx/from @wasm/module)
|
||||
(rx/ignore))
|
||||
(rx/empty))
|
||||
|
||||
(->> (rp/cmd! :get-team {:id (:team-id project)})
|
||||
(rx/mapcat (fn [team]
|
||||
|
@ -290,7 +294,7 @@
|
|||
(rx/of (dtm/set-current-team team)
|
||||
(ptk/data-event ::bundle-stage-1 bundle)))))))))
|
||||
(rx/take-until
|
||||
(rx/filter (ptk/type? ::fetch-bundle) stream))))))
|
||||
(rx/filter (ptk/type? ::fetch-bundle) stream)))))))
|
||||
|
||||
(defn- fetch-bundle-stage-2
|
||||
[{:keys [file-id project-id project] :as bundle}]
|
||||
|
|
|
@ -239,6 +239,7 @@
|
|||
(set! (.-height canvas) (* dpr (.-clientHeight ^js canvas))))
|
||||
|
||||
(defonce module
|
||||
(delay
|
||||
(if (exists? js/dynamicImport)
|
||||
(let [uri (cf/resolve-static-asset "js/render_wasm.js")]
|
||||
(->> (js/dynamicImport (str uri))
|
||||
|
@ -251,4 +252,4 @@
|
|||
(p/merr (fn [cause]
|
||||
(js/console.error cause)
|
||||
(p/resolved false)))))
|
||||
(p/resolved false)))
|
||||
(p/resolved false))))
|
||||
|
|
Loading…
Add table
Reference in a new issue