mirror of https://github.com/logseq/logseq
fix: both pages and blocks indices default to an empty array
parent
4662281c9a
commit
10314b1117
|
@ -47,3 +47,6 @@ dummy.createWritable = function() {};
|
|||
dummy.write = function() {};
|
||||
dummy.close = function() {};
|
||||
dummy.values = function() {};
|
||||
// Do we really need those?
|
||||
dummy.filter = function() {};
|
||||
dummy.concat = function() {};
|
||||
|
|
|
@ -48,9 +48,8 @@
|
|||
(remove string/blank?)
|
||||
(map (fn [p] {:name p}))
|
||||
(bean/->js))]
|
||||
(when (seq pages)
|
||||
(swap! indices assoc-in [repo :pages] pages)
|
||||
pages))))
|
||||
(swap! indices assoc-in [repo :pages] pages)
|
||||
pages)))
|
||||
|
||||
;; TODO: persist indices to indexeddb, it'll be better if the future db
|
||||
;; can has the direct fuzzy search support.
|
||||
|
@ -222,7 +221,8 @@
|
|||
(set))]
|
||||
(swap! search-db/indices update-in [repo :pages]
|
||||
(fn [pages]
|
||||
(let [pages (.filter pages (fn [page]
|
||||
(let [pages (or pages (array))
|
||||
pages (.filter pages (fn [page]
|
||||
(not (contains? pages-to-remove-set
|
||||
(string/lower-case (gobj/get page "name"))))))]
|
||||
(.concat pages (bean/->js pages-to-add)))))))
|
||||
|
@ -241,6 +241,7 @@
|
|||
(set))]
|
||||
(swap! search-db/indices update-in [repo :blocks]
|
||||
(fn [blocks]
|
||||
(let [blocks (.filter blocks (fn [block]
|
||||
(let [blocks (or blocks (array))
|
||||
blocks (.filter blocks (fn [block]
|
||||
(not (contains? blocks-to-remove-set (gobj/get block "id")))))]
|
||||
(.concat blocks (bean/->js blocks-to-add)))))))))))
|
||||
|
|
Loading…
Reference in New Issue