Browse Source

fix: Inline tag for an existing page creates a duplicate tag

fixes https://linear.app/logseq/issue/LOG-3240/inline-tag-for-an-existing-page-creates-a-duplicate-tag
Tienson Qin 1 year ago
parent
commit
83ea2111ae

+ 2 - 1
src/main/frontend/handler/db_based/page.cljs

@@ -57,7 +57,8 @@
 (defn <create-class!
   "Creates a class page and provides class-specific error handling"
   [title options]
-  (-> (page-common-handler/<create! title (assoc options :class? true))
+  (-> (page-common-handler/<create! title (assoc options :class? true
+                                                 :skip-existing-page-check? false))
       (p/catch (fn [e]
                  (when (= :notification (:type (ex-data e)))
                    (notification/show! (get-in (ex-data e) [:payload :message])

+ 6 - 3
src/main/frontend/worker/handler/page/db_based/page.cljs

@@ -159,11 +159,12 @@
 
 (defn create!
   [conn title*
-   {:keys [create-first-block? properties uuid persist-op? whiteboard? class? today-journal? split-namespace?]
+   {:keys [create-first-block? properties uuid persist-op? whiteboard? class? today-journal? split-namespace? skip-existing-page-check?]
     :or   {create-first-block?      true
            properties               nil
            uuid                     nil
-           persist-op?              true}
+           persist-op?              true
+           skip-existing-page-check? false}
     :as options}]
   (let [db @conn
         date-formatter (:logseq.property.journal/title-format (d/entity db :logseq.class/Journal))
@@ -181,7 +182,9 @@
             page      (-> (gp-block/page-name->map title @conn true date-formatter
                                                    {:class? class?
                                                     :page-uuid (when (uuid? uuid) uuid)
-                                                    :skip-existing-page-check? true})
+                                                    :skip-existing-page-check? (if (some? skip-existing-page-check?)
+                                                                                 skip-existing-page-check?
+                                                                                 true)})
                           (assoc :block/format format))
             [page parents] (if (and (text/namespace-page? title) split-namespace?)
                              (let [pages (split-namespace-pages db page date-formatter)]