mirror of
https://github.com/penpot/penpot.git
synced 2025-12-11 22:14:05 +01:00
🐛 Add validation for more instances of missing swap slot
This commit is contained in:
@@ -93,6 +93,7 @@ example. It's still usable as before, we just removed the example.
|
|||||||
- Fix unpublish library modal not scrolling a long file list [Taiga #12285](https://tree.taiga.io/project/penpot/issue/12285)
|
- Fix unpublish library modal not scrolling a long file list [Taiga #12285](https://tree.taiga.io/project/penpot/issue/12285)
|
||||||
- Fix incorrect interaction betwen hower and scroll on assets sidebar [Taiga #12389](https://tree.taiga.io/project/penpot/issue/12389)
|
- Fix incorrect interaction betwen hower and scroll on assets sidebar [Taiga #12389](https://tree.taiga.io/project/penpot/issue/12389)
|
||||||
- Fix switch variants with paths [Taiga #12841](https://tree.taiga.io/project/penpot/issue/12841)
|
- Fix switch variants with paths [Taiga #12841](https://tree.taiga.io/project/penpot/issue/12841)
|
||||||
|
- Fix missing validation for for some instances of missing swap slot [Taiga #12703](https://tree.taiga.io/project/penpot/issue/12703)
|
||||||
|
|
||||||
## 2.11.1
|
## 2.11.1
|
||||||
|
|
||||||
|
|||||||
@@ -326,6 +326,23 @@
|
|||||||
:component-file (:component-file ref-shape)
|
:component-file (:component-file ref-shape)
|
||||||
:component-id (:component-id ref-shape)))))
|
:component-id (:component-id ref-shape)))))
|
||||||
|
|
||||||
|
|
||||||
|
(defn- check-diff-comp-missing-slot
|
||||||
|
"Validate that if this shape points to a different component than its referenced shape, is has a swap slot"
|
||||||
|
[shape file page libraries]
|
||||||
|
(let [ref-shape (ctf/find-ref-shape file page libraries shape :include-deleted? true)]
|
||||||
|
(when (and (some? ref-shape)
|
||||||
|
(not= (:component-id ref-shape) (:component-id shape))
|
||||||
|
(nil? (ctk/get-swap-slot shape)))
|
||||||
|
(report-error :missing-slot
|
||||||
|
(str/ffmt "Referenced shape % points to a different component, so this shape must have been swapped. Should have swap slot" (:shape-ref shape))
|
||||||
|
shape file page
|
||||||
|
:swap-slot (or (ctk/get-swap-slot ref-shape) (:id ref-shape))
|
||||||
|
:component-file (:component-file shape)
|
||||||
|
:component-id (:component-id shape)
|
||||||
|
:ref-component-file (:component-file ref-shape)
|
||||||
|
:ref-component-id (:component-id ref-shape)))))
|
||||||
|
|
||||||
(defn- check-empty-swap-slot
|
(defn- check-empty-swap-slot
|
||||||
"Validate that this shape does not have any swap slot."
|
"Validate that this shape does not have any swap slot."
|
||||||
[shape file page]
|
[shape file page]
|
||||||
@@ -418,8 +435,10 @@
|
|||||||
(check-component-not-main-head shape file page libraries)
|
(check-component-not-main-head shape file page libraries)
|
||||||
(check-component-not-root shape file page)
|
(check-component-not-root shape file page)
|
||||||
(check-valid-touched shape file page)
|
(check-valid-touched shape file page)
|
||||||
|
(check-diff-comp-missing-slot shape file page libraries)
|
||||||
;; We can have situations where the nested copy and the ancestor copy come from different libraries and some of them have been dettached
|
;; We can have situations where the nested copy and the ancestor copy come from different libraries and some of them have been dettached
|
||||||
;; so we only validate the shape-ref if the ancestor is from a valid library
|
;; so we only validate the shape-ref if the ancestor is from a valid library
|
||||||
|
;; TODO library-exists is missing on the stack calls for items inside frames
|
||||||
(when library-exists
|
(when library-exists
|
||||||
(check-component-ref shape file page libraries)
|
(check-component-ref shape file page libraries)
|
||||||
(check-ref-is-head shape file page libraries))
|
(check-ref-is-head shape file page libraries))
|
||||||
|
|||||||
Reference in New Issue
Block a user