瀏覽代碼

Update whiteboard.cljs

Peng Xiao 3 年之前
父節點
當前提交
c8075a7ee0
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      src/main/frontend/handler/whiteboard.cljs

+ 5 - 2
src/main/frontend/handler/whiteboard.cljs

@@ -78,7 +78,8 @@
         ;; todo: use get-paginated-blocks instead?
         existing-blocks (model/get-page-blocks-no-cache (state/get-current-repo) 
                                                         page-name
-                                                        {:pull-keys '[:block/uuid
+                                                        {:pull-keys '[:db/id
+                                                                      :block/uuid
                                                                       {:block/parent [:block/uuid]}]})
         shapes (:shapes tldr-data)
         blocks (mapv #(shape->block % page-name) shapes)
@@ -88,11 +89,13 @@
                        (concat (map :block/uuid blocks))
                        (remove nil?)
                        (set))
-        delete-blocks (filter (fn [block]
+        delete-blocks (filterv (fn [block]
                                 (not (or (block-ids (:block/uuid block))
                                          (block-ids (:block/uuid (:block/parent block))))))
                               existing-blocks)
+        _ (util/pprint delete-blocks)
         delete-blocks-tx (mapv (fn [s] [:db/retractEntity (:db/id s)]) delete-blocks)]
+    (util/pprint delete-blocks-tx)
     (concat [page-block] blocks delete-blocks-tx)))
 
 (defn- get-whiteboard-clj [page-name]