🐛 Fix incorrect handling of assign operation on changes protocol

This commit is contained in:
Andrey Antukh 2025-08-07 09:29:19 +02:00
parent c0c8390a7d
commit f052e31ff0

View File

@ -1091,21 +1091,23 @@
;; === Operations ;; === Operations
(def ^:private decode-shape (def decode-shape-attrs
(sm/decoder cts/schema:shape sm/json-transformer)) (sm/decoder cts/schema:shape-attrs sm/json-transformer))
(defmethod process-operation :assign (defmethod process-operation :assign
[{:keys [type] :as shape} {:keys [value] :as op}] [{:keys [type] :as shape} {:keys [value] :as op}]
(let [modifications (assoc value :type type) (let [modifications (assoc value :type type)
modifications (decode-shape modifications)] modifications (decode-shape-attrs modifications)]
(reduce-kv (fn [shape k v] (reduce-kv (fn [shape k v]
(process-operation shape {:type :set (if (not= v (get shape k))
:attr k (process-operation shape {:type :set
:val v :attr k
:ignore-touched (:ignore-touched op) :val v
:ignore-geometry (:ignore-geometry op)})) :ignore-touched (:ignore-touched op)
:ignore-geometry (:ignore-geometry op)})
shape))
shape shape
modifications))) (dissoc modifications :type))))
(defmethod process-operation :set (defmethod process-operation :set
[shape op] [shape op]