0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-09 08:20:45 -05:00

♻️ Use optimized concat function

This commit is contained in:
Andrés Moya 2020-09-30 10:46:19 +02:00 committed by Alonso Torres
parent 483401f328
commit 2cf15677cc
2 changed files with 18 additions and 18 deletions

View file

@ -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})))

View file

@ -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."