mirror of
https://github.com/penpot/penpot.git
synced 2025-01-24 23:49:45 -05:00
♻️ Use optimized concat function
This commit is contained in:
parent
483401f328
commit
2cf15677cc
2 changed files with 18 additions and 18 deletions
|
@ -413,7 +413,7 @@
|
||||||
[new-shape new-shapes original-shapes]
|
[new-shape new-shapes original-shapes]
|
||||||
(cph/clone-object root-shape nil objects update-new-shape touch-shape)
|
(cph/clone-object root-shape nil objects update-new-shape touch-shape)
|
||||||
|
|
||||||
rchanges (concat
|
rchanges (d/concat
|
||||||
[{:type :mod-component
|
[{:type :mod-component
|
||||||
:id component-id
|
:id component-id
|
||||||
:name (:name new-shape)
|
:name (:name new-shape)
|
||||||
|
@ -426,7 +426,7 @@
|
||||||
:touched nil}]})
|
:touched nil}]})
|
||||||
original-shapes))
|
original-shapes))
|
||||||
|
|
||||||
uchanges (concat
|
uchanges (d/concat
|
||||||
[{:type :mod-component
|
[{:type :mod-component
|
||||||
:id component-id
|
:id component-id
|
||||||
:name (:name component-obj)
|
:name (:name component-obj)
|
||||||
|
@ -458,8 +458,8 @@
|
||||||
(let [[rchanges1 uchanges1] (dwlh/generate-sync-file-components state file-id)
|
(let [[rchanges1 uchanges1] (dwlh/generate-sync-file-components state file-id)
|
||||||
[rchanges2 uchanges2] (dwlh/generate-sync-library-components state file-id)
|
[rchanges2 uchanges2] (dwlh/generate-sync-library-components state file-id)
|
||||||
[rchanges3 uchanges3] (dwlh/generate-sync-file-colors state file-id)
|
[rchanges3 uchanges3] (dwlh/generate-sync-file-colors state file-id)
|
||||||
rchanges (concat rchanges1 rchanges2 rchanges3)
|
rchanges (d/concat rchanges1 rchanges2 rchanges3)
|
||||||
uchanges (concat uchanges1 uchanges2 uchanges3)]
|
uchanges (d/concat uchanges1 uchanges2 uchanges3)]
|
||||||
(rx/concat
|
(rx/concat
|
||||||
(when rchanges
|
(when rchanges
|
||||||
(rx/of (dwc/commit-changes rchanges uchanges {:commit-local? true})))
|
(rx/of (dwc/commit-changes rchanges uchanges {:commit-local? true})))
|
||||||
|
|
|
@ -81,8 +81,8 @@
|
||||||
(let [[page-rchanges page-uchanges]
|
(let [[page-rchanges page-uchanges]
|
||||||
(generate-sync-page-components page library-id components)]
|
(generate-sync-page-components page library-id components)]
|
||||||
(recur (next pages)
|
(recur (next pages)
|
||||||
(concat rchanges page-rchanges)
|
(d/concat rchanges page-rchanges)
|
||||||
(concat uchanges page-uchanges)))))))))
|
(d/concat uchanges page-uchanges)))))))))
|
||||||
|
|
||||||
|
|
||||||
(defn generate-sync-page-components
|
(defn generate-sync-page-components
|
||||||
|
@ -107,8 +107,8 @@
|
||||||
nil
|
nil
|
||||||
false)]
|
false)]
|
||||||
(recur (next shapes)
|
(recur (next shapes)
|
||||||
(concat rchanges shape-rchanges)
|
(d/concat rchanges shape-rchanges)
|
||||||
(concat uchanges shape-uchanges))))))))
|
(d/concat uchanges shape-uchanges))))))))
|
||||||
|
|
||||||
|
|
||||||
(defn generate-sync-library-components
|
(defn generate-sync-library-components
|
||||||
|
@ -132,8 +132,8 @@
|
||||||
(generate-sync-component-components
|
(generate-sync-component-components
|
||||||
local-component library-id components)]
|
local-component library-id components)]
|
||||||
(recur (next local-components)
|
(recur (next local-components)
|
||||||
(concat rchanges comp-rchanges)
|
(d/concat rchanges comp-rchanges)
|
||||||
(concat uchanges comp-uchanges)))))))))
|
(d/concat uchanges comp-uchanges)))))))))
|
||||||
|
|
||||||
|
|
||||||
(defn generate-sync-component-components
|
(defn generate-sync-component-components
|
||||||
|
@ -158,8 +158,8 @@
|
||||||
(:id local-component)
|
(:id local-component)
|
||||||
false)]
|
false)]
|
||||||
(recur (next shapes)
|
(recur (next shapes)
|
||||||
(concat rchanges shape-rchanges)
|
(d/concat rchanges shape-rchanges)
|
||||||
(concat uchanges shape-uchanges))))))))
|
(d/concat uchanges shape-uchanges))))))))
|
||||||
|
|
||||||
|
|
||||||
(defn generate-sync-shape-and-children-components
|
(defn generate-sync-shape-and-children-components
|
||||||
|
@ -187,8 +187,8 @@
|
||||||
component-id
|
component-id
|
||||||
reset-touched?)]
|
reset-touched?)]
|
||||||
(recur (next shapes)
|
(recur (next shapes)
|
||||||
(concat rchanges shape-rchanges)
|
(d/concat rchanges shape-rchanges)
|
||||||
(concat uchanges shape-uchanges))))))))
|
(d/concat uchanges shape-uchanges))))))))
|
||||||
|
|
||||||
(defn generate-sync-shape-components
|
(defn generate-sync-shape-components
|
||||||
"Generate changes to synchronize one shape that is linked to other shape
|
"Generate changes to synchronize one shape that is linked to other shape
|
||||||
|
@ -368,8 +368,8 @@
|
||||||
(let [[page-rchanges page-uchanges]
|
(let [[page-rchanges page-uchanges]
|
||||||
(generate-sync-page-colors library-id page colors)]
|
(generate-sync-page-colors library-id page colors)]
|
||||||
(recur (next pages)
|
(recur (next pages)
|
||||||
(concat rchanges page-rchanges)
|
(d/concat rchanges page-rchanges)
|
||||||
(concat uchanges page-uchanges)))))))))
|
(d/concat uchanges page-uchanges)))))))))
|
||||||
|
|
||||||
(defn generate-sync-page-colors
|
(defn generate-sync-page-colors
|
||||||
"Generate changes to synchronize all shapes in a particular page."
|
"Generate changes to synchronize all shapes in a particular page."
|
||||||
|
@ -393,8 +393,8 @@
|
||||||
(let [[shape-rchanges shape-uchanges]
|
(let [[shape-rchanges shape-uchanges]
|
||||||
(generate-sync-shape-colors shape page colors)]
|
(generate-sync-shape-colors shape page colors)]
|
||||||
(recur (next shapes)
|
(recur (next shapes)
|
||||||
(concat rchanges shape-rchanges)
|
(d/concat rchanges shape-rchanges)
|
||||||
(concat uchanges shape-uchanges))))))))
|
(d/concat uchanges shape-uchanges))))))))
|
||||||
|
|
||||||
(defn generate-sync-shape-colors
|
(defn generate-sync-shape-colors
|
||||||
"Generate changes to synchronize colors of one shape."
|
"Generate changes to synchronize colors of one shape."
|
||||||
|
|
Loading…
Add table
Reference in a new issue