Browse Source

fix: broken page when moving blocks

Tienson Qin 2 years ago
parent
commit
6407cd77ef
2 changed files with 3 additions and 2 deletions
  1. 1 1
      src/main/frontend/db/fix.cljs
  2. 2 1
      src/main/frontend/modules/outliner/core.cljs

+ 1 - 1
src/main/frontend/db/fix.cljs

@@ -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} {})]

+ 2 - 1
src/main/frontend/modules/outliner/core.cljs

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