From f66228c19df0df4277d5c09361ea2e71527a73a6 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 21 Nov 2023 11:37:20 +0100 Subject: [PATCH] :bug: Clean fdata from nils --- backend/src/app/rpc/commands/files_update.clj | 3 ++- common/src/app/common/files/changes.cljc | 2 +- common/src/app/common/files/defaults.cljc | 2 +- common/src/app/common/files/migrations.cljc | 4 +++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/src/app/rpc/commands/files_update.clj b/backend/src/app/rpc/commands/files_update.clj index 883937c68..ff44a1007 100644 --- a/backend/src/app/rpc/commands/files_update.clj +++ b/backend/src/app/rpc/commands/files_update.clj @@ -290,7 +290,8 @@ (-> data (blob/decode) (assoc :id (:id file)) - (pmg/migrate-data)))) + (pmg/migrate-data) + (d/without-nils)))) ;; WARNING: this ruins performance; maybe we need to find ;; some other way to do general validation diff --git a/common/src/app/common/files/changes.cljc b/common/src/app/common/files/changes.cljc index 600de124b..1c5d01e6e 100644 --- a/common/src/app/common/files/changes.cljc +++ b/common/src/app/common/files/changes.cljc @@ -618,7 +618,7 @@ (defmethod process-change :del-media [data {:keys [id]}] - (update data :media dissoc id)) + (d/update-when data :media dissoc id)) ;; -- Components diff --git a/common/src/app/common/files/defaults.cljc b/common/src/app/common/files/defaults.cljc index ff8c0e829..862330dad 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 36) +(def version 37) diff --git a/common/src/app/common/files/migrations.cljc b/common/src/app/common/files/migrations.cljc index 2bb858420..46e5a1110 100644 --- a/common/src/app/common/files/migrations.cljc +++ b/common/src/app/common/files/migrations.cljc @@ -651,7 +651,6 @@ (migrate) (assoc :version 35))) - (defmethod migrate 36 [data] (letfn [(update-container [container] @@ -663,3 +662,6 @@ (update :pages-index update-vals update-container) (update :components update-vals update-container)))) +(defmethod migrate 37 + [data] + (d/without-nils data))