Merge pull request #6997 from penpot/alotor-fix-wasm-bugs

🐛 Fix wasm problems
This commit is contained in:
Andrey Antukh 2025-07-29 12:42:26 +02:00 committed by GitHub
commit 3f657a0c04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 2 deletions

View File

@ -27,7 +27,9 @@
[app.main.data.workspace.libraries :as dwl]
[app.main.data.workspace.thumbnails :as dwth]
[app.main.errors]
[app.main.features :as features]
[app.main.router :as rt]
[app.render-wasm.shape :as wasm.shape]
[app.util.http :as http]
[app.util.i18n :as i18n :refer [tr]]
[beicon.v2.core :as rx]
@ -128,6 +130,14 @@
;; Workspace Page CRUD
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn update-page-root
[file-id page-id]
(ptk/reify ::update-page-root
ptk/UpdateEvent
(update [_ state]
(-> state
(update-in [:files file-id :data :pages-index page-id :objects uuid/zero] wasm.shape/create-shape)))))
(defn create-page
[{:keys [page-id file-id]}]
(let [id (or page-id (uuid/next))]
@ -146,7 +156,11 @@
changes (-> (pcb/empty-changes it)
(pcb/add-empty-page id name))]
(rx/of (dch/commit-changes changes)))))))
(rx/concat
(rx/of (dch/commit-changes changes))
(if (features/active-feature? state "render-wasm/v1")
(rx/of (update-page-root file-id id))
(rx/empty))))))))
(defn duplicate-page
[page-id]

View File

@ -116,7 +116,10 @@
id (get shape :id)]
(case k
:parent-id (api/set-parent-id v)
:type (api/set-shape-type v)
:type (do
(api/set-shape-type v)
(when (or (= v :path) (= v :bool))
(api/set-shape-path-content (:content shape))))
:bool-type (api/set-shape-bool-type v)
:selrect (api/set-shape-selrect v)
:show-content (if (= (:type shape) :frame)