mirror of
https://github.com/penpot/penpot.git
synced 2026-04-25 11:18:36 +00:00
🐛 Fix when retrieving a variant from several with same props, it get the last one
This commit is contained in:
parent
38941d4811
commit
2d36a1f3e0
@ -368,7 +368,8 @@
|
||||
(update pos assoc :value val))
|
||||
valid-comps (->> variant-components
|
||||
(remove #(= (:id %) component-id))
|
||||
(filter #(= (dm/get-in % [:variant-properties pos :value]) val)))
|
||||
(filter #(= (dm/get-in % [:variant-properties pos :value]) val))
|
||||
(reverse))
|
||||
nearest-comp (apply min-key #(ctv/distance target-props (:variant-properties %)) valid-comps)]
|
||||
(when nearest-comp
|
||||
(st/emit! (dwl/component-swap shape (:component-file shape) (:id nearest-comp) true)))))))]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user