🐛 Fix error after user drags layers in search functionality

This commit is contained in:
Alejandro Alonso 2022-09-23 08:16:18 +02:00
parent 441e9627b5
commit 1ef4d42b28
2 changed files with 19 additions and 14 deletions

View file

@ -19,6 +19,7 @@
- Fix selected colors allow gradients in shadows [Taiga #4156](https://tree.taiga.io/project/penpot/issue/4156) - 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 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 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 ## 1.15.3-beta

View file

@ -90,7 +90,7 @@
(l/derived refs/workspace-local))) (l/derived refs/workspace-local)))
(mf/defc layer-item (mf/defc layer-item
[{:keys [index item selected objects] :as props}] [{:keys [index item selected objects sortable?] :as props}]
(let [id (:id item) (let [id (:id item)
selected? (contains? selected id) selected? (contains? selected id)
container? (or (cph/frame-shape? item) container? (or (cph/frame-shape? item)
@ -170,16 +170,17 @@
(when-not expanded? (when-not expanded?
(st/emit! (dwc/toggle-collapse (:id item))))) (st/emit! (dwc/toggle-collapse (:id item)))))
[dprops dref] (hooks/use-sortable [dprops dref] (when sortable?
:data-type "penpot/layer" (hooks/use-sortable
:on-drop on-drop :data-type "penpot/layer"
:on-drag on-drag :on-drop on-drop
:on-hold on-hold :on-drag on-drag
:disabled @disable-drag :on-hold on-hold
:detect-center? container? :disabled @disable-drag
:data {:id (:id item) :detect-center? container?
:index index :data {:id (:id item)
:name (:name item)}) :index index
:name (:name item)}))
ref (mf/use-ref)] ref (mf/use-ref)]
@ -276,13 +277,15 @@
:selected selected :selected selected
:index index :index index
:objects objects :objects objects
:key id}] :key id
:sortable? true}]
[:& layer-item [:& layer-item
{:item obj {:item obj
:selected selected :selected selected
:index index :index index
:objects objects :objects objects
:key id}])))]])) :key id
:sortable? true}])))]]))
(mf/defc filters-tree (mf/defc filters-tree
{::mf/wrap [#(mf/memo % =) {::mf/wrap [#(mf/memo % =)
@ -299,7 +302,8 @@
:selected selected :selected selected
:index index :index index
:objects objects :objects objects
:key id}]))])) :key id
:sortable? false}]))]))
(defn calc-reparented-objects (defn calc-reparented-objects