From 2cf15677cc81b62b60b8acb6845614b2a6f9bdf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Moya?= Date: Wed, 30 Sep 2020 10:46:19 +0200 Subject: [PATCH] :recycle: Use optimized concat function --- .../app/main/data/workspace/libraries.cljs | 8 +++--- .../data/workspace/libraries_helpers.cljs | 28 +++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/frontend/src/app/main/data/workspace/libraries.cljs b/frontend/src/app/main/data/workspace/libraries.cljs index 37c80073b..1180edd32 100644 --- a/frontend/src/app/main/data/workspace/libraries.cljs +++ b/frontend/src/app/main/data/workspace/libraries.cljs @@ -413,7 +413,7 @@ [new-shape new-shapes original-shapes] (cph/clone-object root-shape nil objects update-new-shape touch-shape) - rchanges (concat + rchanges (d/concat [{:type :mod-component :id component-id :name (:name new-shape) @@ -426,7 +426,7 @@ :touched nil}]}) original-shapes)) - uchanges (concat + uchanges (d/concat [{:type :mod-component :id component-id :name (:name component-obj) @@ -458,8 +458,8 @@ (let [[rchanges1 uchanges1] (dwlh/generate-sync-file-components state file-id) [rchanges2 uchanges2] (dwlh/generate-sync-library-components state file-id) [rchanges3 uchanges3] (dwlh/generate-sync-file-colors state file-id) - rchanges (concat rchanges1 rchanges2 rchanges3) - uchanges (concat uchanges1 uchanges2 uchanges3)] + rchanges (d/concat rchanges1 rchanges2 rchanges3) + uchanges (d/concat uchanges1 uchanges2 uchanges3)] (rx/concat (when rchanges (rx/of (dwc/commit-changes rchanges uchanges {:commit-local? true}))) diff --git a/frontend/src/app/main/data/workspace/libraries_helpers.cljs b/frontend/src/app/main/data/workspace/libraries_helpers.cljs index b998593cd..4a8cff84d 100644 --- a/frontend/src/app/main/data/workspace/libraries_helpers.cljs +++ b/frontend/src/app/main/data/workspace/libraries_helpers.cljs @@ -81,8 +81,8 @@ (let [[page-rchanges page-uchanges] (generate-sync-page-components page library-id components)] (recur (next pages) - (concat rchanges page-rchanges) - (concat uchanges page-uchanges))))))))) + (d/concat rchanges page-rchanges) + (d/concat uchanges page-uchanges))))))))) (defn generate-sync-page-components @@ -107,8 +107,8 @@ nil false)] (recur (next shapes) - (concat rchanges shape-rchanges) - (concat uchanges shape-uchanges)))))))) + (d/concat rchanges shape-rchanges) + (d/concat uchanges shape-uchanges)))))))) (defn generate-sync-library-components @@ -132,8 +132,8 @@ (generate-sync-component-components local-component library-id components)] (recur (next local-components) - (concat rchanges comp-rchanges) - (concat uchanges comp-uchanges))))))))) + (d/concat rchanges comp-rchanges) + (d/concat uchanges comp-uchanges))))))))) (defn generate-sync-component-components @@ -158,8 +158,8 @@ (:id local-component) false)] (recur (next shapes) - (concat rchanges shape-rchanges) - (concat uchanges shape-uchanges)))))))) + (d/concat rchanges shape-rchanges) + (d/concat uchanges shape-uchanges)))))))) (defn generate-sync-shape-and-children-components @@ -187,8 +187,8 @@ component-id reset-touched?)] (recur (next shapes) - (concat rchanges shape-rchanges) - (concat uchanges shape-uchanges)))))))) + (d/concat rchanges shape-rchanges) + (d/concat uchanges shape-uchanges)))))))) (defn generate-sync-shape-components "Generate changes to synchronize one shape that is linked to other shape @@ -368,8 +368,8 @@ (let [[page-rchanges page-uchanges] (generate-sync-page-colors library-id page colors)] (recur (next pages) - (concat rchanges page-rchanges) - (concat uchanges page-uchanges))))))))) + (d/concat rchanges page-rchanges) + (d/concat uchanges page-uchanges))))))))) (defn generate-sync-page-colors "Generate changes to synchronize all shapes in a particular page." @@ -393,8 +393,8 @@ (let [[shape-rchanges shape-uchanges] (generate-sync-shape-colors shape page colors)] (recur (next shapes) - (concat rchanges shape-rchanges) - (concat uchanges shape-uchanges)))))))) + (d/concat rchanges shape-rchanges) + (d/concat uchanges shape-uchanges)))))))) (defn generate-sync-shape-colors "Generate changes to synchronize colors of one shape."