♻️ 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:
Eva Marco 2026-10-01 11:42:30 +02:00 committed by Andrés Moya
parent 7fee18dc1a
commit 36a0ac0a04
2 changed files with 9 additions and 9 deletions

View File

@ -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))

View File

@ -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?