🐛 Make component changes watcher look on local commits only

This commit is contained in:
Andrey Antukh 2024-06-25 15:47:24 +02:00
parent ec4260830c
commit fc30e81072

View file

@ -1164,14 +1164,15 @@
changes-s changes-s
(->> stream (->> stream
(rx/filter #(or (dch/commit? %) (rx/filter dch/commit?)
(ptk/type? % ::dwn/handle-file-change))) (rx/map deref)
(rx/filter #(= :local (:source %)))
(rx/observe-on :async)) (rx/observe-on :async))
check-changes check-changes
(fn [[event [old-data _mid_data _new-data]]] (fn [[event [old-data _mid_data _new-data]]]
(when old-data (when old-data
(let [{:keys [file-id changes save-undo? undo-group]} (deref event) (let [{:keys [file-id changes save-undo? undo-group]} event
changed-components changed-components
(when (or (nil? file-id) (= file-id (:id old-data))) (when (or (nil? file-id) (= file-id (:id old-data)))
@ -1181,7 +1182,7 @@
(if (d/not-empty? changed-components) (if (d/not-empty? changed-components)
(if save-undo? (if save-undo?
(do (log/info :msg "DETECTED COMPONENTS CHANGED" (do (log/info :hint "detected component changes"
:ids (map str changed-components) :ids (map str changed-components)
:undo-group undo-group) :undo-group undo-group)
@ -1190,7 +1191,8 @@
;; even if save-undo? is false, we need to update the :modified-date of the component ;; even if save-undo? is false, we need to update the :modified-date of the component
;; (for example, for undos) ;; (for example, for undos)
(->> (rx/from changed-components) (->> (rx/from changed-components)
(rx/map #(touch-component %)))) (rx/map touch-component)))
(rx/empty))))) (rx/empty)))))
changes-s changes-s