diff --git a/frontend/src/app/main/data/workspace.cljs b/frontend/src/app/main/data/workspace.cljs index 20145e549..91c7032c3 100644 --- a/frontend/src/app/main/data/workspace.cljs +++ b/frontend/src/app/main/data/workspace.cljs @@ -183,14 +183,10 @@ (ptk/reify ::initialize-page ptk/UpdateEvent (update [_ state] - ;; TODO: looks workspace-page is unused - (let [page (get-in state [:workspace-data :pages-index page-id]) - local (get-in state [:workspace-cache page-id] workspace-local-default)] + (let [local (get-in state [:workspace-cache page-id] workspace-local-default)] (assoc state :current-page-id page-id ; mainly used by events - :workspace-page page - :workspace-local local - ))))) + :workspace-local local))))) (defn finalize-page [page-id] @@ -201,7 +197,7 @@ (let [local (:workspace-local state)] (-> state (assoc-in [:workspace-cache page-id] local) - (dissoc :current-page-id :workspace-page)))))) + (dissoc :current-page-id)))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Workspace Page CRUD diff --git a/frontend/src/app/main/data/workspace/common.cljs b/frontend/src/app/main/data/workspace/common.cljs index 62311fcd3..0cc55a692 100644 --- a/frontend/src/app/main/data/workspace/common.cljs +++ b/frontend/src/app/main/data/workspace/common.cljs @@ -187,7 +187,7 @@ (ptk/reify ::rehash-shape-frame-relationship ptk/WatchEvent (watch [_ state stream] - (let [page-id (get-in state [:workspace-page :id]) + (let [page-id (:current-page-id state) objects (lookup-page-objects state page-id) shapes (cph/select-toplevel-shapes objects) diff --git a/frontend/src/app/main/refs.cljs b/frontend/src/app/main/refs.cljs index 3c74b88de..11e0bca48 100644 --- a/frontend/src/app/main/refs.cljs +++ b/frontend/src/app/main/refs.cljs @@ -165,7 +165,7 @@ (def selected-objects (letfn [(selector [state] (let [selected (get-in state [:workspace-local :selected]) - page-id (get-in state [:workspace-page :id]) + page-id (:current-page-id state) objects (get-in state [:workspace-data :pages-index page-id :objects])] (mapv #(get objects %) selected)))] (l/derived selector st/state =))) @@ -173,7 +173,7 @@ (def selected-shapes-with-children (letfn [(selector [state] (let [selected (get-in state [:workspace-local :selected]) - page-id (get-in state [:workspace-page :id]) + page-id (:current-page-id state) objects (get-in state [:workspace-data :pages-index page-id :objects]) children (mapcat #(cph/get-children % objects) selected)] (into selected children)))] @@ -184,7 +184,7 @@ (def selected-objects-with-children (letfn [(selector [state] (let [selected (get-in state [:workspace-local :selected]) - page-id (get-in state [:workspace-page :id]) + page-id (:current-page-id state) objects (get-in state [:workspace-data :pages-index page-id :objects]) children (mapcat #(cph/get-children % objects) selected) shapes (into selected children)] diff --git a/frontend/src/app/main/ui/workspace/sidebar.cljs b/frontend/src/app/main/ui/workspace/sidebar.cljs index 10ccf7948..bd0cb4437 100644 --- a/frontend/src/app/main/ui/workspace/sidebar.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar.cljs @@ -39,13 +39,12 @@ ;; --- Right Sidebar (Component) -;; TODO: revisit page prop - (mf/defc right-sidebar [{:keys [layout page-id file-id local] :as props}] [:aside#settings-bar.settings-bar [:div.settings-bar-inside (when (contains? layout :element-options) - [:& options-toolbox {:page-id page-id + [:& options-toolbox + {:page-id page-id :file-id file-id :local local}])]])