浏览代码

fix: no need to update existing object's classes

Tienson Qin 2 年之前
父节点
当前提交
3af4b7e530
共有 1 个文件被更改,包括 2 次插入11 次删除
  1. 2 11
      src/main/frontend/components/property/value.cljs

+ 2 - 11
src/main/frontend/components/property/value.cljs

@@ -106,20 +106,11 @@
                            (let [page (string/trim (if (string? chosen) chosen (:value chosen)))
                                  id (:block/uuid (db/entity [:block/name (util/page-name-sanity-lc page)]))
                                  class? (= (:block/name property) "tags")]
-                             (cond
-                               (nil? id)
+                             (when (nil? id)
                                (page-handler/create! page {:redirect? false
                                                            :create-first-block? false
                                                            :tags classes
-                                                           :class? class?})
-                               ;; user typed a new option to get here so update the existing page
-                               ;; to make their option valid
-                               (seq classes)
-                               (db/transact! repo
-                                             [{:block/uuid id
-                                               :block/tags (map (fn [class]
-                                                                  {:db/id (:db/id (db/entity repo [:block/uuid class]))}) classes)}]
-                                             {:outliner-op :save-block}))
+                                                           :class? class?}))
                              (let [id' (or id (:block/uuid (db/entity [:block/name (util/page-name-sanity-lc page)])))]
                                (add-property! block (:block/original-name property) id'))
                              (when-let [f (:on-chosen opts)] (f))))