🐛 Fix forcing wasm via url param

This commit is contained in:
Alejandro Alonso
2026-02-11 12:40:58 +01:00
parent d991d59852
commit 5996284d4b
2 changed files with 33 additions and 8 deletions

View File

@@ -50,17 +50,41 @@
(set/union (get team :features)) (set/union (get team :features))
(setup-wasm-features state)))) (setup-wasm-features state))))
(defn enabled-by-flags?
[{:keys [features-runtime features]} feature]
(or (contains? features-runtime feature)
(contains? features feature)))
(defn enabled-without-migration?
[{:keys [features-runtime features]} feature]
(or (contains? features-runtime feature)
(contains? global-enabled-features feature)
(contains? features feature)))
(defn wasm-url-override
[state]
(case (get (rt/get-params state) :wasm)
"true" true
"false" false
nil))
(defn active-feature? (defn active-feature?
"Given a state and feature, check if feature is enabled." "Given a state and feature, check if feature is enabled."
[state feature] [state feature]
(assert (contains? cfeat/supported-features feature) "feature not supported") (assert (contains? cfeat/supported-features feature)
(let [runtime-features (get state :features-runtime) "feature not supported")
enabled-features (get state :features)]
(or (contains? runtime-features feature) (let [wasm-override (when (= feature "render-wasm/v1")
(if (contains? cfeat/no-migration-features feature) (wasm-url-override state))]
(or (contains? global-enabled-features feature) (cond
(contains? enabled-features feature)) (some? wasm-override)
(contains? enabled-features feature))))) wasm-override
(contains? cfeat/no-migration-features feature)
(enabled-without-migration? state feature)
:else
(enabled-by-flags? state feature))))
(def ^:private features-ref (def ^:private features-ref
(l/derived (l/key :features) st/state)) (l/derived (l/key :features) st/state))

View File

@@ -17,6 +17,7 @@
(mf/defc text-edition-outline (mf/defc text-edition-outline
[{:keys [shape zoom modifiers]}] [{:keys [shape zoom modifiers]}]
(println "text-edition-outline" (features/active-feature? @st/state "render-wasm/v1"))
(if (features/active-feature? @st/state "render-wasm/v1") (if (features/active-feature? @st/state "render-wasm/v1")
(let [{:keys [width height]} (wasm.api/get-text-dimensions (:id shape)) (let [{:keys [width height]} (wasm.api/get-text-dimensions (:id shape))
selrect-transform (mf/deref refs/workspace-selrect) selrect-transform (mf/deref refs/workspace-selrect)