fix: broken page when moving blocks

feat/db-inferred-properties
Tienson Qin 2023-08-22 16:13:56 +08:00
parent fea174d661
commit 6407cd77ef
2 changed files with 3 additions and 2 deletions

View File

@ -152,7 +152,7 @@
[db page-id {:keys [fix-parent-left? fix-broken-chain? replace-tx?]
:or {fix-parent-left? true
fix-broken-chain? true
replace-tx? true}
replace-tx? false}
:as _opts}]
(let [repo (state/get-current-repo)
transact-opts (if replace-tx? {:replace? true} {})]

View File

@ -851,7 +851,8 @@
:as opts}]
[:pre [(seq blocks)
(s/valid? ::block-map-or-entity target-block)]]
(let [[target-block sibling?] (get-target-block target-block opts)
(let [blocks (map (fn [b] (db/pull [:block/uuid (:block/uuid b)])) blocks)
[target-block sibling?] (get-target-block target-block opts)
non-consecutive-blocks? (seq (db-model/get-non-consecutive-blocks blocks))
original-position? (move-to-original-position? blocks target-block sibling? non-consecutive-blocks?)]
(when (and (not (contains? (set (map :db/id blocks)) (:db/id target-block)))