enhance: don't show diff if there's only blank changes

pull/2777/head
Tienson Qin 2021-09-06 23:23:27 +08:00
parent 0b55d119aa
commit b86a801514
2 changed files with 5 additions and 3 deletions

View File

@ -247,7 +247,7 @@
[:span.cp__diff-file-header-content.pl-1.font-medium {:style {:word-break "break-word"}}
(str "File " path " has been modified on the disk.")]]
[:div.p-4
(when (not= disk-content db-content)
(when (not= (string/trim disk-content) (string/trim db-content))
(ui/foldable
[:span.text-sm.font-medium.ml-1 "Check diff"]
(fn []

View File

@ -22,7 +22,8 @@
[datascript.core :as d]
["semver" :as semver]
[clojure.set :as set]
[rum.core :as rum]))
[rum.core :as rum]
[clojure.string :as string]))
;; TODO: should we move all events here?
@ -156,7 +157,8 @@
(defmethod handle :file/not-matched-from-disk [[_ path disk-content db-content]]
(state/clear-edit!)
(when-let [repo (state/get-current-repo)]
(state/set-modal! #(diff/local-file repo path disk-content db-content))))
(when (not= (string/trim disk-content) (string/trim db-content))
(state/set-modal! #(diff/local-file repo path disk-content db-content)))))
(defmethod handle :modal/display-file-version [[_ path content hash]]
(state/set-modal! #(git-component/file-specific-version path hash content)))