fix: references not calculated right

related to https://github.com/logseq/db-test/issues/436#issuecomment-3217902953
This commit is contained in:
Tienson Qin
2025-08-25 12:49:06 +08:00
parent 53bfcbee76
commit 77c7412271
3 changed files with 12 additions and 12 deletions

View File

@@ -113,12 +113,12 @@
:or {replace-tag? true}}]
(assert (string? title))
(let [refs' (->> refs
(remove (fn [ref]
;; remove uuid references since they're introduced to detect multiple pages
;; that have the same name
(and (map? ref)
(:block.temp/original-page-name ref)
(common-util/uuid-string? (:block.temp/original-page-name ref)))))
(map (fn [ref]
;; remove uuid references since they're introduced to detect multiple pages
;; that have the same name
(if (and (map? ref) (some-> (:block.temp/original-page-name ref) common-util/uuid-string?))
(dissoc ref :block.temp/original-page-name)
ref)))
(map
(fn [ref]
(if (and (vector? ref) (= :block/uuid (first ref)))
@@ -127,9 +127,8 @@
ref)))
sort-refs)]
(reduce
(fn [content {uuid' :block/uuid :block/keys [title] :as block}]
(let [title' (or (:block.temp/original-page-name block) title)]
(replace-page-ref-with-id content title' uuid' replace-tag?)))
(fn [content {uuid' :block/uuid :block/keys [title]}]
(replace-page-ref-with-id content title uuid' replace-tag?))
title
(filter :block/title refs'))))

View File

@@ -617,6 +617,7 @@
(when (:block/uuid target-block)
(d/entity db [:block/uuid (:block/uuid target-block)])))]
(let [linked (:block/link block)
library? (ldb/library? block)
up-down? (= outliner-op :move-blocks-up-down)
[block sibling?] (cond
up-down?
@@ -648,7 +649,7 @@
[last-child true]
[block false])
:else
[block sibling?])
[block (if library? false sibling?)])
linked
(get-last-child-or-self db linked)