diff --git a/frontend/src/app/main/data/workspace/pages.cljs b/frontend/src/app/main/data/workspace/pages.cljs index 73cbcdb1bb..3945bb7f24 100644 --- a/frontend/src/app/main/data/workspace/pages.cljs +++ b/frontend/src/app/main/data/workspace/pages.cljs @@ -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] diff --git a/frontend/src/app/render_wasm/shape.cljs b/frontend/src/app/render_wasm/shape.cljs index 298a7ff353..933695e540 100644 --- a/frontend/src/app/render_wasm/shape.cljs +++ b/frontend/src/app/render_wasm/shape.cljs @@ -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)