Browse Source

chore: remove db-graph? check

Tienson Qin 1 month ago
parent
commit
dd27a85a5a
1 changed files with 8 additions and 15 deletions
  1. 8 15
      deps/db/src/logseq/db/common/initial_data.cljs

+ 8 - 15
deps/db/src/logseq/db/common/initial_data.cljs

@@ -328,9 +328,7 @@
   "Returns current database schema and initial data.
    NOTE: This fn is called by DB and file graphs"
   [db]
-  (let [db-graph? (entity-plus/db-based-graph? db)
-        _ (when db-graph?
-            (reset! db-order/*max-key (db-order/get-max-order db)))
+  (let [_ (reset! db-order/*max-key (db-order/get-max-order db))
         schema (:schema db)
         idents (mapcat (fn [id]
                          (when-let [e (d/entity db id)]
@@ -343,22 +341,17 @@
                         :logseq.kv/graph-backup-folder
                         :logseq.kv/graph-text-embedding-model-name
                         :logseq.property/empty-placeholder])
-        favorites (when db-graph? (get-favorites db))
+        favorites (get-favorites db)
         recent-updated-pages (let [pages (get-recent-updated-pages db)]
                                (mapcat (fn [p] (d/datoms db :eavt (:db/id p))) pages))
         all-files (get-all-files db)
-        structured-datoms (when db-graph?
-                            (get-structured-datoms db))
+        structured-datoms (get-structured-datoms db)
         user-datoms (get-all-user-datoms db)
-        pages-datoms (if db-graph?
-                       (let [contents-id (get-first-page-by-title db "Contents")
-                             capture-page-id (:db/id (db-db/get-built-in-page db common-config/quick-add-page-name))
-                             views-id (get-first-page-by-title db common-config/views-page-name)]
-                         (mapcat #(d/datoms db :eavt %)
-                                 (remove nil? [contents-id capture-page-id views-id])))
-                       ;; load all pages for file graphs
-                       (->> (d/datoms db :avet :block/name)
-                            (mapcat (fn [d] (d/datoms db :eavt (:e d))))))
+        pages-datoms (let [contents-id (get-first-page-by-title db "Contents")
+                           capture-page-id (:db/id (db-db/get-built-in-page db common-config/quick-add-page-name))
+                           views-id (get-first-page-by-title db common-config/views-page-name)]
+                       (mapcat #(d/datoms db :eavt %)
+                               (remove nil? [contents-id capture-page-id views-id])))
         data (->> (concat idents
                           structured-datoms
                           user-datoms