🐛 Fix incorrect access to flows on add-new-interaction event

This commit is contained in:
Andrey Antukh 2024-11-25 13:29:08 +01:00
parent 8448036d67
commit 723eef9565
2 changed files with 14 additions and 12 deletions

View file

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

View file

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