🐛 Disable thumbnails render in wasm

This commit is contained in:
alonso.torres 2026-01-27 12:47:33 +01:00 committed by Aitor Moreno
parent 9808b6ca57
commit 3cb716ec30
2 changed files with 54 additions and 44 deletions

View File

@ -105,9 +105,15 @@
(if (dsh/lookup-page state file-id page-id) (if (dsh/lookup-page state file-id page-id)
(rx/concat (rx/concat
(rx/of (initialize-page* file-id page-id) (rx/of (initialize-page* file-id page-id)
(fdf/fix-deleted-fonts-for-page file-id page-id) (fdf/fix-deleted-fonts-for-page file-id page-id))
(dwth/watch-state-changes file-id page-id)
(dwl/watch-component-changes)) ;; Disable thumbnail generation in wasm renderer
(if (features/active-feature? state "render-wasm/v1")
(rx/empty)
(rx/of (dwth/watch-state-changes file-id page-id)))
(rx/of (dwl/watch-component-changes))
(let [profile (:profile state) (let [profile (:profile state)
props (get profile :props)] props (get profile :props)]
(when (not (:workspace-visited props)) (when (not (:workspace-visited props))

View File

@ -191,59 +191,63 @@
[page-id [event [old-data new-data]]] [page-id [event [old-data new-data]]]
(let [changes (:changes event) (let [changes (:changes event)
lookup-data-objects ;; cache for the get-frame-ids function
(fn [data page-id] frame-id-cache (atom {})]
(dm/get-in data [:pages-index page-id :objects]))
(letfn [(lookup-data-objects [data page-id]
(dm/get-in data [:pages-index page-id :objects]))
extract-ids (extract-ids [{:keys [page-id type] :as change}]
(fn [{:keys [page-id type] :as change}] (case type
(case type :add-obj [[page-id (:id change)]]
:add-obj [[page-id (:id change)]] :mod-obj [[page-id (:id change)]]
:mod-obj [[page-id (:id change)]] :del-obj [[page-id (:id change)]]
:del-obj [[page-id (:id change)]] :mov-objects (->> (:shapes change) (map #(vector page-id %)))
:mov-objects (->> (:shapes change) (map #(vector page-id %))) []))
[]))
get-frame-ids (get-frame-ids [id]
(fn get-frame-ids [id] (let [old-objects (lookup-data-objects old-data page-id)
(let [old-objects (lookup-data-objects old-data page-id) new-objects (lookup-data-objects new-data page-id)
new-objects (lookup-data-objects new-data page-id)
new-shape (get new-objects id) new-shape (get new-objects id)
old-shape (get old-objects id) old-shape (get old-objects id)
old-frame-id (if (cfh/frame-shape? old-shape) id (:frame-id old-shape)) old-frame-id (if (cfh/frame-shape? old-shape) id (:frame-id old-shape))
new-frame-id (if (cfh/frame-shape? new-shape) id (:frame-id new-shape)) new-frame-id (if (cfh/frame-shape? new-shape) id (:frame-id new-shape))
root-frame-old? (cfh/root-frame? old-objects old-frame-id) root-frame-old? (cfh/root-frame? old-objects old-frame-id)
root-frame-new? (cfh/root-frame? new-objects new-frame-id) root-frame-new? (cfh/root-frame? new-objects new-frame-id)
instance-root? (ctc/instance-root? new-shape)] instance-root? (ctc/instance-root? new-shape)]
(cond-> #{} (cond-> #{}
root-frame-old? root-frame-old?
(conj ["frame" old-frame-id]) (conj ["frame" old-frame-id])
root-frame-new? root-frame-new?
(conj ["frame" new-frame-id]) (conj ["frame" new-frame-id])
instance-root? instance-root?
(conj ["component" id]) (conj ["component" id])
(and (uuid? (:frame-id old-shape)) (and (uuid? (:frame-id old-shape))
(not= uuid/zero (:frame-id old-shape))) (not= uuid/zero (:frame-id old-shape)))
(into (get-frame-ids (:frame-id old-shape))) (into (get-frame-ids (:frame-id old-shape)))
(and (uuid? (:frame-id new-shape)) (and (uuid? (:frame-id new-shape))
(not= uuid/zero (:frame-id new-shape))) (not= uuid/zero (:frame-id new-shape)))
(into (get-frame-ids (:frame-id new-shape))))))] (into (get-frame-ids (:frame-id new-shape))))))
(into #{} (get-frame-ids-cached [id]
(comp (mapcat extract-ids) (or (get @frame-id-cache id)
(filter (fn [[page-id']] (= page-id page-id'))) (let [result (get-frame-ids id)]
(map (fn [[_ id]] id)) (swap! frame-id-cache assoc id result)
(mapcat get-frame-ids)) result)))]
changes))) (into #{}
(comp (mapcat extract-ids)
(filter (fn [[page-id']] (= page-id page-id')))
(map (fn [[_ id]] id))
(mapcat get-frame-ids-cached))
changes))))
(defn watch-state-changes (defn watch-state-changes
"Watch the state for changes inside frames. If a change is detected will force a rendering "Watch the state for changes inside frames. If a change is detected will force a rendering