diff --git a/src/main/frontend/components/property/value.cljs b/src/main/frontend/components/property/value.cljs index 17f728825..8806663df 100644 --- a/src/main/frontend/components/property/value.cljs +++ b/src/main/frontend/components/property/value.cljs @@ -429,11 +429,11 @@ (p/do! (add-property-f (if (map? chosen) (:value chosen) chosen)) (when-let [f (:on-chosen select-opts)] (f)))) - selected-choices' (->> (get block (:db/ident property)) - (map (fn [x] (if (= :date type) (:db/id x) x))) - (remove nil?)) + selected-choices' (get block (:db/ident property)) selected-choices (if (coll? selected-choices') - selected-choices' + (->> selected-choices' + (map (fn [x] (if (= :date type) (:db/id x) x))) + (remove nil?)) [selected-choices'])] (select-aux block property (cond-> diff --git a/src/main/frontend/handler/db_based/property.cljs b/src/main/frontend/handler/db_based/property.cljs index 703f3b359..f658615f8 100644 --- a/src/main/frontend/handler/db_based/property.cljs +++ b/src/main/frontend/handler/db_based/property.cljs @@ -353,7 +353,6 @@ (defn remove-block-property! [repo eid property-id] - (prn :debug :eid eid :property-id property-id) (if (contains? #{:block/alias :block/tags} property-id) (when-let [block (db/entity eid)] (db/transact! repo @@ -367,23 +366,17 @@ (when block (when (not= property-id (:db/ident block)) (when-let [property (db/entity property-id)] - (let [schema (:block/schema property) - db-ident (:db/ident property) - tags-or-alias? (contains? #{:block/tags :block/alias} db-ident)] - (if tags-or-alias? + (let [schema (:block/schema property)] + (if (= :many (:cardinality schema)) (db/transact! repo - [[:db/retract (:db/id block) db-ident property-value]] + [[:db/retract (:db/id block) property-id property-value]] {:outliner-op :save-block}) - (if (= :many (:cardinality schema)) - (db/transact! repo - [[:db/retract (:db/id block) property-id]] - {:outliner-op :save-block}) - (if (= :default (get-in property [:block/schema :type])) - (set-block-property! repo (:db/id block) - (:db/ident property) - "" - {}) - (remove-block-property! repo (:db/id block) property-id))))))))) + (if (= :default (get-in property [:block/schema :type])) + (set-block-property! repo (:db/id block) + (:db/ident property) + "" + {}) + (remove-block-property! repo (:db/id block) property-id)))))))) (defn replace-key-with-id "Notice: properties need to be created first"