0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-06 14:50:20 -05:00

Merge pull request #5370 from penpot/niwinz-bugfix-4

🐛 Fix incorrect access to flows on add-new-interaction event
This commit is contained in:
Pablo Alba 2024-11-25 15:41:13 +01:00 committed by GitHub
commit 59e5656bd7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 12 deletions

View file

@ -409,12 +409,14 @@
;; Resize parent containers that need to
(pcb/resize-parents parents))))
(defn change-show-in-viewer [shape hide?]
(defn change-show-in-viewer
[shape hide?]
(assoc shape :hide-in-viewer hide?))
(defn add-new-interaction [shape interaction]
(-> shape
(update :interactions ctsi/add-interaction interaction)))
(defn add-new-interaction
[shape interaction]
(update shape :interactions ctsi/add-interaction interaction))
(defn show-in-viewer [shape]
(defn show-in-viewer
[shape]
(dissoc shape :hide-in-viewer))

View file

@ -168,7 +168,7 @@
objects (get page :objects)
frame (cfh/get-root-frame objects (:id shape))
flows (get page :objects)
flows (get page :flows)
flow (ctp/get-frame-flow flows (:id frame))]
(rx/concat
(rx/of (dwsh/update-shapes
@ -177,14 +177,14 @@
(let [new-interaction (-> ctsi/default-interaction
(ctsi/set-destination destination)
(assoc :position-relative-to (:id shape)))]
(cls/add-new-interaction shape new-interaction))))
(cls/add-new-interaction shape new-interaction)))))
(when destination
(dwsh/update-shapes [destination] cls/show-in-viewer))
(when destination
(rx/of (dwsh/update-shapes [destination] cls/show-in-viewer)))
(when (and (not (connected-frame? objects (:id frame)))
(nil? flow))
(add-flow (:id frame))))))))))
(when (and (not (connected-frame? objects (:id frame)))
(nil? flow))
(rx/of (add-flow (:id frame))))))))))
(defn remove-interaction
([shape index]