Browse Source

fix: closed values persisting as incorrect data structure

Closed values were persisting as a list instead of a vector which can
cause bugs e.g.  `get` doesn't work on lists. One of these is from
LOG-3101
Gabriel Horner 1 year ago
parent
commit
dff458ceb3
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/main/frontend/handler/db_based/property.cljs

+ 2 - 2
src/main/frontend/handler/db_based/property.cljs

@@ -682,7 +682,7 @@
   (assert (and (uuid? new-id) (uuid? old-id)))
   (let [schema (-> (:block/schema property)
                    (update :values (fn [values]
-                                     (conj (remove #{old-id} values) new-id))))]
+                                     (vec (conj (remove #{old-id} values) new-id)))))]
     (db/transact! (state/get-current-repo)
                   [{:db/id (:db/id property)
                     :block/schema schema}]
@@ -773,7 +773,7 @@
     (let [values' (remove string/blank? values)
           property-schema (:block/schema property)]
       (if (every? uuid? values')
-        (p/let [new-value-ids (remove #(nil? (db/entity [:block/uuid %])) values')]
+        (p/let [new-value-ids (vec (remove #(nil? (db/entity [:block/uuid %])) values'))]
           (when (seq new-value-ids)
             (let [property-tx {:db/id (:db/id property)
                                :block/schema (assoc property-schema :values new-value-ids)}]