fix: linked references not refreshed

This commit is contained in:
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

@@ -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]]