mirror of
https://github.com/logseq/logseq.git
synced 2026-05-01 01:16:27 +00:00
@@ -157,24 +157,25 @@
|
||||
|
||||
(defn- new-db
|
||||
[cached-result tx-data old-db k]
|
||||
(try
|
||||
(let [empty-db (d/empty-db db-schema/schema)
|
||||
db (or old-db
|
||||
(when (and (coll? cached-result)
|
||||
(or (map? (first cached-result))
|
||||
(empty? cached-result)))
|
||||
(let [cached-result (util/remove-nils cached-result)]
|
||||
(-> empty-db
|
||||
(d/with cached-result)
|
||||
(:db-after)))))]
|
||||
(when db
|
||||
(:db-after (d/with db tx-data))))
|
||||
(catch js/Error e
|
||||
(prn "New db: " {:k k
|
||||
:old-db old-db
|
||||
:cached-result cached-result})
|
||||
(js/console.error e)
|
||||
old-db)))
|
||||
(when-not (= :custom (second k))
|
||||
(try
|
||||
(let [empty-db (d/empty-db db-schema/schema)
|
||||
db (or old-db
|
||||
(when (and (coll? cached-result)
|
||||
(or (map? (first cached-result))
|
||||
(empty? cached-result)))
|
||||
(let [cached-result (util/remove-nils cached-result)]
|
||||
(-> empty-db
|
||||
(d/with cached-result)
|
||||
(:db-after)))))]
|
||||
(when db
|
||||
(:db-after (d/with db tx-data))))
|
||||
(catch js/Error e
|
||||
(prn "New db: " {:k k
|
||||
:old-db old-db
|
||||
:cached-result cached-result})
|
||||
(js/console.error e)
|
||||
old-db))))
|
||||
|
||||
(defn get-query-cached-result
|
||||
[k]
|
||||
|
||||
Reference in New Issue
Block a user