mirror of
https://github.com/penpot/penpot.git
synced 2025-01-09 16:30:37 -05:00
🐛 Properly filter complex data on events payload
This commit is contained in:
parent
70beb6c60c
commit
e6d6b60b63
1 changed files with 16 additions and 2 deletions
|
@ -133,6 +133,19 @@
|
|||
(dissoc ::context)
|
||||
(cond-> origin (assoc :origin origin)))}))))
|
||||
|
||||
(defn- filter-props
|
||||
"Removes complex data types from props."
|
||||
[data]
|
||||
(into {}
|
||||
(map (fn [[k v :as kv]]
|
||||
(cond
|
||||
(map? v) [k :placeholder/map]
|
||||
(vector? v) [k :placeholder/vec]
|
||||
(set? v) [k :placeholder/set]
|
||||
(coll? v) [k :placeholder/coll]
|
||||
:else kv)))
|
||||
data))
|
||||
|
||||
(defmethod process-event ::generic-action
|
||||
[event]
|
||||
(let [type (ptk/type event)
|
||||
|
@ -143,8 +156,9 @@
|
|||
|
||||
{:type "action"
|
||||
:name (or (::name mdata) (name type))
|
||||
:props (merge (d/without-nils data)
|
||||
(d/without-nils (::props mdata)))
|
||||
:props (-> (merge (d/without-nils data)
|
||||
(d/without-nils (::props mdata)))
|
||||
(filter-props))
|
||||
:context (d/without-nils
|
||||
{:event-origin (::origin mdata)
|
||||
:event-namespace (namespace type)
|
||||
|
|
Loading…
Reference in a new issue