0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-21 06:02:32 -05:00

🐛 Fix exception on adding animation to an interraction

Happens when an animation is added to a just created interaction
and then changed to other animation type. Bug is caused by missing
dependency on react handlers.
This commit is contained in:
Andrey Antukh 2024-10-28 18:21:02 +01:00
parent 6b817d102b
commit d9310d651a

View file

@ -226,27 +226,27 @@
change-event-type
(mf/use-fn
(mf/deps index)
(mf/deps index update-interaction)
(fn [event]
(let [value (keyword event)]
(update-interaction index #(ctsi/set-event-type % value shape)))))
change-action-type
(mf/use-fn
(mf/deps index)
(mf/deps index update-interaction)
(fn [event]
(let [value (keyword event)]
(update-interaction index #(ctsi/set-action-type % value)))))
change-delay
(mf/use-fn
(mf/deps index)
(mf/deps index update-interaction)
(fn [value]
(update-interaction index #(ctsi/set-delay % value))))
change-destination
(mf/use-fn
(mf/deps index)
(mf/deps index update-interaction)
(fn [event]
(let [value event
value (when (not= value "") (uuid/uuid value))]
@ -254,21 +254,21 @@
change-position-relative-to
(mf/use-fn
(mf/deps index)
(mf/deps index update-interaction)
(fn [event]
(let [value (uuid/uuid event)]
(update-interaction index #(ctsi/set-position-relative-to % value)))))
change-preserve-scroll
(mf/use-fn
(mf/deps index)
(mf/deps index update-interaction)
(fn [event]
(let [value (-> event dom/get-target dom/checked?)]
(update-interaction index #(ctsi/set-preserve-scroll % value)))))
change-url
(mf/use-fn
(mf/deps index)
(mf/deps index update-interaction)
(fn [event]
(let [target (dom/get-target event)
value (dom/get-value target)
@ -287,7 +287,7 @@
change-overlay-pos-type
(mf/use-fn
(mf/deps shape)
(mf/deps shape update-interaction)
(fn [value]
(let [shape-id (:id shape)]
(update-interaction index #(ctsi/set-overlay-pos-type % value shape objects))
@ -296,7 +296,7 @@
toggle-overlay-pos-type
(mf/use-fn
(mf/deps index)
(mf/deps index update-interaction)
(fn [event]
(let [pos-type (-> (dom/get-current-target event)
(dom/get-data "value")
@ -305,21 +305,21 @@
change-close-click-outside
(mf/use-fn
(mf/deps index)
(mf/deps index update-interaction)
(fn [event]
(let [value (-> event dom/get-target dom/checked?)]
(update-interaction index #(ctsi/set-close-click-outside % value)))))
change-background-overlay
(mf/use-fn
(mf/deps index)
(mf/deps index update-interaction)
(fn [event]
(let [value (-> event dom/get-target dom/checked?)]
(update-interaction index #(ctsi/set-background-overlay % value)))))
change-animation-type
(mf/use-fn
(mf/deps index)
(mf/deps index update-interaction)
(fn [event]
(let [value (if (= "" event)
nil
@ -327,33 +327,35 @@
(update-interaction index #(ctsi/set-animation-type % value)))))
change-duration
(mf/use-fn (fn [value]
(update-interaction index #(ctsi/set-duration % value))))
(mf/use-fn
(mf/deps index update-interaction)
(fn [value]
(update-interaction index #(ctsi/set-duration % value))))
change-easing
(mf/use-fn
(mf/deps index)
(mf/deps index update-interaction)
(fn [event]
(let [value (keyword event)]
(update-interaction index #(ctsi/set-easing % value)))))
change-way
(mf/use-fn
(mf/deps index)
(mf/deps index update-interaction)
(fn [event]
(let [value (keyword event)]
(update-interaction index #(ctsi/set-way % value)))))
change-direction
(mf/use-fn
(mf/deps index)
(mf/deps index update-interaction)
(fn [event]
(let [value (keyword event)]
(update-interaction index #(ctsi/set-direction % value)))))
change-offset-effect
(mf/use-fn
(mf/deps index)
(mf/deps index update-interaction)
(fn [event]
(let [value (-> event dom/get-target dom/checked?)]
(update-interaction index #(ctsi/set-offset-effect % value)))))