From 7273112a00f7189f253b7078b888a9bb14db161b Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Mon, 6 Sep 2021 11:23:31 +0800 Subject: [PATCH] git: revert back --- src/main/frontend/fs/watcher_handler.cljs | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/src/main/frontend/fs/watcher_handler.cljs b/src/main/frontend/fs/watcher_handler.cljs index 02dc6121a..c8d8fa31b 100644 --- a/src/main/frontend/fs/watcher_handler.cljs +++ b/src/main/frontend/fs/watcher_handler.cljs @@ -29,8 +29,6 @@ (when-not (= (str id-property) (str block-id)) (editor/set-block-property! block-id "id" block-id))))))) -(def ignore-files (atom {})) - (defn handle-changed! [type {:keys [dir path content stat] :as payload}] (when dir @@ -56,24 +54,11 @@ ;; ignore truncate (not (string/blank? content)) (not= (string/trim content) - (string/trim (or (db/get-file repo path) ""))) - (not (string/includes? path "logseq/pages-metadata.edn")) - (not= (get @ignore-files path) content)) - (p/let [ - ;; save the previous content in Logseq first and commit it to avoid - ;; any data-loss. - _ (swap! ignore-files assoc path db-content) - _ (file-handler/alter-file repo path db-content {:re-render-root? false - :reset? false - :skip-compare? true}) - result (ipc/ipc "gitCommitAll" "") - _ (file-handler/alter-file repo path content {:re-render-root? true + (string/trim (or (db/get-file repo path) "")))) + (p/let [_ (file-handler/alter-file repo path content {:re-render-root? true :from-disk? true})] (set-missing-block-ids! content) (db/set-file-last-modified-at! repo path mtime) - (js/setTimeout (fn [] - (when (= db-content (get @ignore-files path)) - (swap! ignore-files dissoc path))) 2000) nil) (contains? #{"add" "change" "unlink"} type)