From 6a3b963a77115a09c683a56c6a1ef15f5f97b4d5 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 1 Sep 2023 13:37:50 +0200 Subject: [PATCH] :bug: Add migration that fixes all frames that does not have `:shapes` attr --- common/src/app/common/files/defaults.cljc | 2 +- common/src/app/common/files/migrations.cljc | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/common/src/app/common/files/defaults.cljc b/common/src/app/common/files/defaults.cljc index d0ee2994cc..3cfaccf207 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 29) +(def version 30) diff --git a/common/src/app/common/files/migrations.cljc b/common/src/app/common/files/migrations.cljc index c2ee6ff84f..ae11417ac6 100644 --- a/common/src/app/common/files/migrations.cljc +++ b/common/src/app/common/files/migrations.cljc @@ -561,3 +561,18 @@ (-> data (update :pages-index update-vals update-container) (update :components update-vals update-container)))) + +(defmethod migrate 30 + [data] + (letfn [(update-object [object] + (if (and (cph/frame-shape? object) + (not (:shapes object))) + (assoc object :shapes []) + object)) + + (update-container [container] + (update container :objects update-vals update-object))] + + (-> data + (update :pages-index update-vals update-container) + (update :components update-vals update-container))))