mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 00:40:30 -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)
|
(dissoc ::context)
|
||||||
(cond-> origin (assoc :origin origin)))}))))
|
(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
|
(defmethod process-event ::generic-action
|
||||||
[event]
|
[event]
|
||||||
(let [type (ptk/type event)
|
(let [type (ptk/type event)
|
||||||
|
@ -143,8 +156,9 @@
|
||||||
|
|
||||||
{:type "action"
|
{:type "action"
|
||||||
:name (or (::name mdata) (name type))
|
:name (or (::name mdata) (name type))
|
||||||
:props (merge (d/without-nils data)
|
:props (-> (merge (d/without-nils data)
|
||||||
(d/without-nils (::props mdata)))
|
(d/without-nils (::props mdata)))
|
||||||
|
(filter-props))
|
||||||
:context (d/without-nils
|
:context (d/without-nils
|
||||||
{:event-origin (::origin mdata)
|
{:event-origin (::origin mdata)
|
||||||
:event-namespace (namespace type)
|
:event-namespace (namespace type)
|
||||||
|
|
Loading…
Reference in a new issue