mirror of
https://github.com/penpot/penpot.git
synced 2026-11-03 00:20:41 +00:00
♻️ Use if instead of or and when in builder fallbacks
prepare-restore-component and generate-delete-shapes fall back to other data when the changes builder has no library data, objects or page. Use an if on the has-*? check instead of (or (when ...) ...), which is easier to read. AI-assisted-by: claude-opus-5-5
This commit is contained in:
parent
7fee18dc1a
commit
36a0ac0a04
@ -442,13 +442,13 @@
|
||||
(prepare-restore-component changes library-data component-id page nil nil nil nil)))
|
||||
|
||||
([changes library-data component-id page position old-id parent-id frame-id]
|
||||
(let [library-data (or (when (pcb/has-library-data? changes)
|
||||
(pcb/get-library-data changes))
|
||||
library-data)
|
||||
(let [library-data (if (pcb/has-library-data? changes)
|
||||
(pcb/get-library-data changes)
|
||||
library-data)
|
||||
component (ctkl/get-deleted-component library-data component-id)
|
||||
objects (or (when (pcb/has-objects? changes)
|
||||
(pcb/get-objects changes))
|
||||
(:objects page))
|
||||
objects (if (pcb/has-objects? changes)
|
||||
(pcb/get-objects changes)
|
||||
(:objects page))
|
||||
parent (get objects parent-id)
|
||||
main-inst (get-in component [:objects (:main-instance-id component)])
|
||||
inside-component? (some? (ctn/get-instance-root (:objects page) parent))
|
||||
|
||||
@ -269,9 +269,9 @@
|
||||
(let [objects (pcb/get-objects changes)
|
||||
data (pcb/get-library-data changes)
|
||||
page-id (pcb/get-page-id changes)
|
||||
page (or (when (pcb/has-page? changes)
|
||||
(pcb/get-page changes))
|
||||
(ctpl/get-page data page-id))
|
||||
page (if (pcb/has-page? changes)
|
||||
(pcb/get-page changes)
|
||||
(ctpl/get-page data page-id))
|
||||
ids (cfh/clean-loops objects ids)
|
||||
|
||||
in-component-copy?
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user