fix: linked references not refreshed

pull/1872/head
Tienson Qin 2021-05-14 23:17:46 +08:00
parent 175988244a
commit 2767b8359d
2 changed files with 8 additions and 11 deletions

View File

@ -65,11 +65,6 @@
journal? (date/valid-journal-title? (string/capitalize page-name))
repo (state/get-current-repo)
ref-blocks (cond
priority?
(db/get-blocks-by-priority repo page-name)
marker?
(db/get-marker-blocks repo page-name)
block-id
(db/get-block-referenced-blocks block-id)
:else

View File

@ -234,12 +234,14 @@
[:page/mentioned-pages current-page-id]])
(apply concat
(for [{:block/keys [refs]} blocks]
(mapcat (fn [ref]
(when-let [block (db-utils/entity ref)]
[[:page/blocks (:db/id (:block/page block))]
[:block/refed-blocks (:db/id block)]]))
refs))))
(for [{:block/keys [refs]} blocks]
(mapcat (fn [ref]
(when-let [block (if (and (map? ref) (:block/name ref))
(db-utils/entity [:block/name (:block/name ref)])
(db-utils/entity ref))]
[[:page/blocks (:db/id (:block/page block))]
[:block/refed-blocks (:db/id block)]]))
refs))))
(distinct))
refed-pages (map
(fn [[k page-id]]