diff --git a/CHANGES.md b/CHANGES.md index 1ac9d5ae5..06c1c20c2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -19,6 +19,7 @@ - Fix selected colors allow gradients in shadows [Taiga #4156](https://tree.taiga.io/project/penpot/issue/4156) - Fix import files with unexpected format or invalid content [Taiga #4136](https://tree.taiga.io/project/penpot/issue/4136) - Fix wrong shortcut button tip of "Delete" function [Taiga #4162](https://tree.taiga.io/project/penpot/issue/4162) +- Fix error after user drags any layer in search functionality [Taiga #4161](https://tree.taiga.io/project/penpot/issue/4161) ## 1.15.3-beta diff --git a/frontend/src/app/main/ui/workspace/sidebar/layers.cljs b/frontend/src/app/main/ui/workspace/sidebar/layers.cljs index 05ad9bdfd..87265242d 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/layers.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/layers.cljs @@ -90,7 +90,7 @@ (l/derived refs/workspace-local))) (mf/defc layer-item - [{:keys [index item selected objects] :as props}] + [{:keys [index item selected objects sortable?] :as props}] (let [id (:id item) selected? (contains? selected id) container? (or (cph/frame-shape? item) @@ -170,16 +170,17 @@ (when-not expanded? (st/emit! (dwc/toggle-collapse (:id item))))) - [dprops dref] (hooks/use-sortable - :data-type "penpot/layer" - :on-drop on-drop - :on-drag on-drag - :on-hold on-hold - :disabled @disable-drag - :detect-center? container? - :data {:id (:id item) - :index index - :name (:name item)}) + [dprops dref] (when sortable? + (hooks/use-sortable + :data-type "penpot/layer" + :on-drop on-drop + :on-drag on-drag + :on-hold on-hold + :disabled @disable-drag + :detect-center? container? + :data {:id (:id item) + :index index + :name (:name item)})) ref (mf/use-ref)] @@ -276,13 +277,15 @@ :selected selected :index index :objects objects - :key id}] + :key id + :sortable? true}] [:& layer-item {:item obj :selected selected :index index :objects objects - :key id}])))]])) + :key id + :sortable? true}])))]])) (mf/defc filters-tree {::mf/wrap [#(mf/memo % =) @@ -299,7 +302,8 @@ :selected selected :index index :objects objects - :key id}]))])) + :key id + :sortable? false}]))])) (defn calc-reparented-objects