refactor: better handling of empty block

related to #2140 and #2139
This commit is contained in:
Tienson Qin
2021-06-10 00:34:54 +08:00
parent 0061657d32
commit 870d46ecfe
11 changed files with 202 additions and 154 deletions

View File

@@ -359,6 +359,7 @@
{:block/name (string/lower-case ref)}
ref)))
(remove vector?)
(remove nil?)
(distinct))]
(recur (rest blocks)
(conj acc (assoc block :block/path-refs path-ref-pages))
@@ -630,7 +631,8 @@
(map :db/id))
{:block/keys [refs]} new-block
ref-pages (filter :block/name refs)
path-ref-pages (concat ref-pages parent-refs [(:db/id page)])
path-ref-pages (->> (concat ref-pages parent-refs [(:db/id page)])
(remove nil?))
block (merge
block
new-block