From 946309a485ef483b3b93910d82c4376daf1a8913 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 15 Jul 2021 16:50:56 +0200 Subject: [PATCH] :paperclip: Add migration for cleaning unused props on file data. --- common/src/app/common/pages/common.cljc | 2 +- common/src/app/common/pages/migrations.cljc | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/common/src/app/common/pages/common.cljc b/common/src/app/common/pages/common.cljc index 29319abef4..cda7ad1a92 100644 --- a/common/src/app/common/pages/common.cljc +++ b/common/src/app/common/pages/common.cljc @@ -8,7 +8,7 @@ (:require [app.common.uuid :as uuid])) -(def file-version 8) +(def file-version 10) (def default-color "#b1b2b5") ;; $color-gray-20 (def root uuid/zero) diff --git a/common/src/app/common/pages/migrations.cljc b/common/src/app/common/pages/migrations.cljc index 861b5c0b4d..1c3ab69ab1 100644 --- a/common/src/app/common/pages/migrations.cljc +++ b/common/src/app/common/pages/migrations.cljc @@ -234,7 +234,7 @@ (:shapes shape)))))) (map :id))) - (update-page [[page-id page]] + (calculate-changes [[page-id page]] (let [objects (:objects page) eids (find-empty-groups objects)] @@ -245,7 +245,15 @@ eids)))] (loop [data data] - (let [changes (mapcat update-page (:pages-index data))] + (let [changes (mapcat calculate-changes (:pages-index data))] (if (seq changes) (recur (cp/process-changes data changes)) data))))) + +(defmethod migrate 10 + [data] + (letfn [(update-page [_ page] + (d/update-in-when page [:objects uuid/zero] dissoc :points :selrect))] + (update data :pages-index #(d/mapm update-page %)))) + +