diff --git a/common/src/app/common/files/migrations.cljc b/common/src/app/common/files/migrations.cljc index 96f7dcca78..55585cdb7e 100644 --- a/common/src/app/common/files/migrations.cljc +++ b/common/src/app/common/files/migrations.cljc @@ -1547,14 +1547,10 @@ (update component :path #(d/nilv % "")))] (d/update-when data :components d/update-vals update-component))) -(defmethod migrate-data "0014-fix-tokens-lib-duplicate-ids" - [data _] - (d/update-when data :tokens-lib types.tokens-lib/fix-duplicate-token-set-ids)) - (def ^:private valid-stroke? (sm/lazy-validator cts/schema:stroke)) -(defmethod migrate-data "0015-clear-invalid-strokes-and-fills" +(defmethod migrate-data "0013-clear-invalid-strokes-and-fills" [data _] (letfn [(clear-color-image [image] (select-keys image types.color/image-attrs)) @@ -1621,6 +1617,10 @@ (update :pages-index d/update-vals update-container) (d/update-when :components d/update-vals update-container)))) +(defmethod migrate-data "0014-fix-tokens-lib-duplicate-ids" + [data _] + (d/update-when data :tokens-lib types.tokens-lib/fix-duplicate-token-set-ids)) + (def available-migrations (into (d/ordered-set) ["legacy-2" @@ -1690,5 +1690,5 @@ "0011-fix-invalid-text-touched-flags" "0012-fix-position-data" "0013-fix-component-path" - "0014-fix-tokens-lib-duplicate-ids" - "0015-clear-invalid-strokes-and-fills"])) + "0013-clear-invalid-strokes-and-fills" + "0014-fix-tokens-lib-duplicate-ids"])) diff --git a/common/src/app/common/schema.cljc b/common/src/app/common/schema.cljc index f546beed38..a4d3d662ce 100644 --- a/common/src/app/common/schema.cljc +++ b/common/src/app/common/schema.cljc @@ -420,7 +420,7 @@ :min 0 :max 1 :compile - (fn [{:keys [kind max min] :as props} children _] + (fn [{:keys [kind max min ordered] :as props} children _] (let [kind (or (last children) kind) pred @@ -456,18 +456,23 @@ (fn [value] (every? pred value))) + empty-set + (if ordered + (d/ordered-set) + #{}) + decode (fn [v] (cond (string? v) (let [v (str/split v #"[\s,]+")] - (into #{} xf:filter-word-strings v)) + (into empty-set xf:filter-word-strings v)) (set? v) v (coll? v) - (into #{} v) + (into empty-set v) :else v)) diff --git a/common/src/app/common/types/file.cljc b/common/src/app/common/types/file.cljc index 87e6ee739b..2c65cc21f2 100644 --- a/common/src/app/common/types/file.cljc +++ b/common/src/app/common/types/file.cljc @@ -106,7 +106,7 @@ [:version :int] [:features ::cfeat/features] [:migrations {:optional true} - [::sm/set :string]]]) + [::sm/set {:ordered true} :string]]]) (sm/register! ::data schema:data) (sm/register! ::file schema:file)