From 07bc5d911be1d1a1f13eb3a23a5f61aa4df50ea3 Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Tue, 31 Oct 2023 11:23:31 +0100 Subject: [PATCH] :bug: Fix open path when showing a component in assets --- frontend/src/app/main/data/workspace.cljs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/frontend/src/app/main/data/workspace.cljs b/frontend/src/app/main/data/workspace.cljs index 6d1706cc6..e8fe34645 100644 --- a/frontend/src/app/main/data/workspace.cljs +++ b/frontend/src/app/main/data/workspace.cljs @@ -1350,15 +1350,19 @@ (ptk/reify ::show-component-in-assets ptk/WatchEvent (watch [_ state _] - (let [project-id (get-in state [:workspace-project :id]) - file-id (get-in state [:workspace-file :id]) - page-id (get state :current-page-id) - pparams {:file-id file-id :project-id project-id} - qparams {:page-id page-id :layout :assets}] - (rx/of (rt/nav :workspace pparams qparams) - (set-assets-section-open file-id :library true) - (set-assets-section-open file-id :components true) - (select-single-asset file-id component-id :components)))) + (let [project-id (get-in state [:workspace-project :id]) + file-id (get-in state [:workspace-file :id]) + page-id (get state :current-page-id) + pparams {:file-id file-id :project-id project-id} + qparams {:page-id page-id :layout :assets} + component-path (cph/split-path (get-in state [:workspace-data :components component-id :path])) + paths (map (fn [i] (cph/join-path (take (inc i) component-path))) (range (count component-path)))] + (rx/concat + (rx/from (map #(set-assets-group-open file-id :components % true) paths)) + (rx/of (rt/nav :workspace pparams qparams) + (set-assets-section-open file-id :library true) + (set-assets-section-open file-id :components true) + (select-single-asset file-id component-id :components))))) ptk/EffectEvent (effect [_ _ _]