8000 :bug: Fix restore totally deleted variant should add props as name by pabloalba · Pull Request #6423 · penpot/penpot · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

🐛 Fix restore totally deleted variant should add props as name #6423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions common/src/app/common/logic/libraries.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -442,12 +442,12 @@
changes
(rest moved-shapes))
changes (cond-> changes
;; Transform variant info into name when restoring into a parent that is not a variant-container
(and is-variant? parent (not (ctk/is-variant-container? parent)))
;; Transform variant info into name when restoring into a parent that is not a variant-container,
;; or when restoring into a variant-container that doesn't exists anymore
(and is-variant?
(or (and parent (not (ctk/is-variant-container? parent)))
(nil? restoring-into-parent)))
(clvp/generate-make-shapes-no-variant [first-shape])
;; Remove variant info when restoring into a variant-container that doesn't exists anymore
(and is-variant? (nil? restoring-into-parent))
(clvp/generate-delete-variant-info first-shape)
;; Add variant info and rename when restoring into a variant-container
(ctk/is-variant-container? restoring-into-parent)
(clvp/generate-make-shapes-variant [first-shape] restoring-into-parent))]
Expand Down
10 changes: 0 additions & 10 deletions common/src/app/common/logic/variant_properties.cljc
56B9
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,6 @@
related-components)]
changes))


(defn generate-delete-variant-info
[changes shape]
(-> changes
(pcb/update-component (:component-id shape)
#(dissoc % :variant-id :variant-properties)
{:apply-changes-local-library? true})
(pcb/update-shapes [(:id shape)]
#(dissoc % :variant-id :variant-name))))

(defn- generate-make-shape-no-variant
[changes shape]
(let [new-name (ctv/variant-name-to-name shape)
Expand Down
0