🐛 Clean invalid library colors

This commit is contained in:
Andrey Antukh 2025-07-07 11:40:13 +02:00
parent accd5226d7
commit 9ea3f81bc4

View file

@ -1019,8 +1019,8 @@
[data _]
(let [update-colors
(fn [colors]
(into {} (filter #(-> % val types.color/valid-color?) colors)))]
(update data :colors update-colors)))
(into {} (filter #(-> % val types.color/valid-library-color?) colors)))]
(d/update-when data :colors update-colors)))
(defmethod migrate-data "legacy-52"
[data _]
@ -1034,7 +1034,6 @@
(update data :pages-index d/update-vals update-page)))
(defmethod migrate-data "legacy-53"
[data _]
(migrate-data data "legacy-26"))
@ -1517,6 +1516,17 @@
(d/update-when data :colors d/update-vals clear-color)))
(defmethod migrate-data "0009-clean-library-colors"
[data _]
(d/update-when data :colors
(fn [colors]
(reduce-kv (fn [colors id color]
(if (types.color/valid-library-color? color)
colors
(dissoc colors id)))
colors
colors))))
(def available-migrations
(into (d/ordered-set)
["legacy-2"
@ -1580,4 +1590,5 @@
"0005-deprecate-image-type"
"0006-fix-old-texts-fills"
"0007-clear-invalid-strokes-and-fills-v2"
"0008-fix-library-colors-v4"]))
"0008-fix-library-colors-v4"
"0009-clean-library-colors"]))