🐛 Fix variant switch in another page (#6802)

This commit is contained in:
Pablo Alba 2025-06-27 12:23:54 +02:00 committed by GitHub
parent 804146ae9a
commit 20b5b7f6e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 2 deletions

View file

@ -91,11 +91,14 @@
;; shape on the main component
orig-ref-shape (ctf/find-ref-shape nil container libraries original-shape)
orig-ref-objects (-> (ctf/get-component-container-from-head orig-ref-shape libraries)
:objects)
;; Adds a :shape-path attribute to the children of the orig-ref-shape,
;; that contains the type of its ancestors and its name
o-ref-shapes-wp (add-unique-path
(reverse (cfh/get-children-with-self objects (:id orig-ref-shape)))
objects
(reverse (cfh/get-children-with-self orig-ref-objects (:id orig-ref-shape)))
orig-ref-objects
(:id orig-ref-shape))
;; Creates a map to quickly find a child of the orig-ref-shape by its shape-path

View file

@ -242,6 +242,13 @@
(cfh/make-container component-page :page))
(cfh/make-container component :component)))
(defn get-component-container-from-head
[instance-head libraries & {:keys [include-deleted?] :or {include-deleted? true}}]
(let [library-data (-> (get-component-library libraries instance-head)
:data)
component (ctkl/get-component library-data (:component-id instance-head) include-deleted?)]
(get-component-container library-data component)))
(defn get-component-root
"Retrieve the root shape of the component."
[file-data component]