Pārlūkot izejas kodu

fix: try to fix duplicated journals

Relates to https://github.com/logseq/logseq/issues/595
Tienson Qin 5 gadi atpakaļ
vecāks
revīzija
ccc88a37e2
1 mainītis faili ar 5 papildinājumiem un 10 dzēšanām
  1. 5 10
      src/main/frontend/handler/repo.cljs

+ 5 - 10
src/main/frontend/handler/repo.cljs

@@ -154,6 +154,7 @@
          content (cond
                    content
                    content
+
                    template
                    (str default-content template)
 
@@ -169,16 +170,10 @@
        (p/let [_ (-> (fs/mkdir (str repo-dir "/" config/default-journals-directory))
                      (p/catch (fn [_e])))
                file-exists? (fs/create-if-not-exists repo-dir file-path content)]
-         ;; TODO: why file exists but page not created
-         (p/let [resolved-content (if file-exists?
-                                    (file-handler/load-file repo-url path)
-                                    (p/resolved content))]
-           (let [content (if (string/blank? (string/trim resolved-content))
-                           content
-                           resolved-content)]
-             (db/reset-file! repo-url path content)
-             (ui-handler/re-render-root!)
-             (git-handler/git-add repo-url path))))))))
+         (when-not file-exists?
+           (db/reset-file! repo-url path content)
+           (ui-handler/re-render-root!)
+           (git-handler/git-add repo-url path)))))))
 
 (defn create-default-files!
   [repo-url]