Browse Source

fix(rtc): db/retract when :type/link/schema/properties is nil

rcmerci 1 year ago
parent
commit
b892c9abe9
1 changed files with 8 additions and 0 deletions
  1. 8 0
      src/main/frontend/worker/rtc/core.cljs

+ 8 - 0
src/main/frontend/worker/rtc/core.cljs

@@ -314,6 +314,14 @@
               (swap! *other-tx-data conj [:db/retract db-id :block/alias]))
             (when (contains? key-set :tags)
               (swap! *other-tx-data conj [:db/retract db-id :block/tags]))
+            (when (contains? key-set :type)
+              (swap! *other-tx-data conj [:db/retract db-id :block/type]))
+            (when (and (contains? key-set :link) (nil? (:link op-value)))
+              (swap! *other-tx-data conj [:db/retract db-id :block/link]))
+            (when (and (contains? key-set :schema) (nil? (:schema op-value)))
+              (swap! *other-tx-data conj [:db/retract db-id :block/schema]))
+            (when (and (contains? key-set :properties) (nil? (:properties op-value)))
+              (swap! *other-tx-data conj [:db/retract db-id :block/properties]))
             (when (seq @*other-tx-data)
               (ldb/transact! conn @*other-tx-data {:persist-op? false}))
             (transact-db! :save-block repo conn date-formatter new-block)))))))