浏览代码

Fix root node block refs when cutting + pasting.

Tobias Domhan 1 年之前
父节点
当前提交
3aa596f344
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      src/main/frontend/modules/outliner/tree.cljs

+ 2 - 0
src/main/frontend/modules/outliner/tree.cljs

@@ -137,5 +137,7 @@
   [repo db-id]
   [repo db-id]
   (when-let [root-block (db/pull db-id)]
   (when-let [root-block (db/pull db-id)]
     (let [blocks (db/get-block-and-children repo (:block/uuid root-block))
     (let [blocks (db/get-block-and-children repo (:block/uuid root-block))
+          ; the root-block returned by db/pull misses :block/_refs therefore we use the one from db/get-block-and-children
+          root-block (first (filter (fn [b] (= (:db/id b) db-id)) blocks))
           blocks-exclude-root (remove (fn [b] (= (:db/id b) db-id)) blocks)]
           blocks-exclude-root (remove (fn [b] (= (:db/id b) db-id)) blocks)]
       (sort-blocks blocks-exclude-root root-block))))
       (sort-blocks blocks-exclude-root root-block))))