From f29112537736e6c21d73d987ecfa4cfc09c7a8f9 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 12 Sep 2024 21:33:01 +0200 Subject: [PATCH] :bug: Add migration for invalid value on layout-wrap-type on shape prop --- common/src/app/common/files/defaults.cljc | 2 +- common/src/app/common/files/migrations.cljc | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/common/src/app/common/files/defaults.cljc b/common/src/app/common/files/defaults.cljc index 6ef70b5ea5..4c2dd1d963 100644 --- a/common/src/app/common/files/defaults.cljc +++ b/common/src/app/common/files/defaults.cljc @@ -6,4 +6,4 @@ (ns app.common.files.defaults) -(def version 51) +(def version 52) diff --git a/common/src/app/common/files/migrations.cljc b/common/src/app/common/files/migrations.cljc index 111d050726..218103f325 100644 --- a/common/src/app/common/files/migrations.cljc +++ b/common/src/app/common/files/migrations.cljc @@ -1010,13 +1010,25 @@ (defn migrate-up-51 "This migration fixes library invalid colors" - [data] (let [update-colors (fn [colors] (into {} (filter #(-> % val valid-color?) colors)))] (update data :colors update-colors))) +(defn migrate-up-52 + "Fixes incorrect value on `layout-wrap-type` prop" + [data] + (letfn [(update-shape [shape] + (if (= :no-wrap (:layout-wrap-type shape)) + (assoc shape :layout-wrap-type :nowrap) + shape)) + + (update-page [page] + (d/update-when page :objects update-vals update-shape))] + + (update data :pages-index update-vals update-page))) + (def migrations "A vector of all applicable migrations" [{:id 2 :migrate-up migrate-up-2} @@ -1059,4 +1071,5 @@ {:id 48 :migrate-up migrate-up-48} {:id 49 :migrate-up migrate-up-49} {:id 50 :migrate-up migrate-up-50} - {:id 51 :migrate-up migrate-up-51}]) + {:id 51 :migrate-up migrate-up-51} + {:id 52 :migrate-up migrate-up-52}])