mirror of https://github.com/logseq/logseq
enhance(perf): edit the page itself should be fast no matter how
many refs it haspull/3117/head
parent
cd1f68b741
commit
b46055328e
|
@ -56,13 +56,19 @@
|
|||
(reset! query-state state)))
|
||||
|
||||
(defn get-current-repo-refs-keys
|
||||
[]
|
||||
[{:keys [key data]}]
|
||||
(when-let [current-repo (state/get-current-repo)]
|
||||
(->>
|
||||
(map (fn [[repo k id]]
|
||||
(when (and (= repo current-repo)
|
||||
(contains? #{:block/refed-blocks :block/unlinked-refs} k))
|
||||
[k id]))
|
||||
(if (= k :block/refed-blocks)
|
||||
(if (every? (fn [m]
|
||||
(when (map? m)
|
||||
(= id (:db/id (:block/page m))))) data)
|
||||
nil
|
||||
[k id])
|
||||
[k id])))
|
||||
(keys @query-state))
|
||||
(remove nil?))))
|
||||
|
||||
|
@ -250,7 +256,6 @@
|
|||
|
||||
(when current-page-id
|
||||
[[:page/ref-pages current-page-id]
|
||||
;; [:block/refed-blocks current-page-id]
|
||||
[:page/mentioned-pages current-page-id]])
|
||||
|
||||
(apply concat
|
||||
|
@ -272,7 +277,8 @@
|
|||
(when (= k :block/refed-blocks)
|
||||
[:page/ref-pages page-id]))
|
||||
related-keys)
|
||||
all-refed-blocks (get-current-repo-refs-keys)
|
||||
all-refed-blocks (get-current-repo-refs-keys {:key key
|
||||
:data data})
|
||||
custom-queries (some->>
|
||||
(filter (fn [v]
|
||||
(and (= (first v) (state/get-current-repo))
|
||||
|
|
Loading…
Reference in New Issue