From 4f81f9636a8036ebac07f0c9db51f1d1d253970a Mon Sep 17 00:00:00 2001 From: Eva Date: Wed, 11 Jan 2023 18:00:10 +0100 Subject: [PATCH] :recycle: Change uuid/next for js/Symbol on undo-id for transactions --- frontend/src/app/main/data/workspace.cljs | 2 +- .../app/main/data/workspace/interactions.cljs | 2 +- .../app/main/data/workspace/libraries.cljs | 8 ++-- .../app/main/data/workspace/modifiers.cljs | 3 +- .../app/main/data/workspace/selection.cljs | 2 +- .../src/app/main/data/workspace/shapes.cljs | 2 +- .../app/main/data/workspace/transforms.cljs | 3 +- .../app/main/ui/workspace/sidebar/assets.cljs | 37 +++++++++---------- .../sidebar/options/menus/measures.cljs | 3 +- 9 files changed, 29 insertions(+), 33 deletions(-) diff --git a/frontend/src/app/main/data/workspace.cljs b/frontend/src/app/main/data/workspace.cljs index e01bc88f9..e642bd17a 100644 --- a/frontend/src/app/main/data/workspace.cljs +++ b/frontend/src/app/main/data/workspace.cljs @@ -1618,7 +1618,7 @@ :height height :grow-type (if (> (count text) 100) :auto-height :auto-width) :content (as-content text)} - undo-id (uuid/next)] + undo-id (js/Symbol)] (rx/of (dwu/start-undo-transaction undo-id) (dwsh/create-and-add-shape :text x y shape) diff --git a/frontend/src/app/main/data/workspace/interactions.cljs b/frontend/src/app/main/data/workspace/interactions.cljs index ce22d5aec..3eefbff6c 100644 --- a/frontend/src/app/main/data/workspace/interactions.cljs +++ b/frontend/src/app/main/data/workspace/interactions.cljs @@ -246,7 +246,7 @@ :always (ctsi/set-destination (:id target-frame)))) - undo-id (uuid/next)] + undo-id (js/Symbol)] (rx/of (dwu/start-undo-transaction undo-id) diff --git a/frontend/src/app/main/data/workspace/libraries.cljs b/frontend/src/app/main/data/workspace/libraries.cljs index 7a028d0ac..a4ce6a4a5 100644 --- a/frontend/src/app/main/data/workspace/libraries.cljs +++ b/frontend/src/app/main/data/workspace/libraries.cljs @@ -154,7 +154,7 @@ (pcb/with-library-data data) (pcb/update-color color)) - undo-id (uuid/next)] + undo-id (js/Symbol)] (rx/of (dwu/start-undo-transaction undo-id) (dch/commit-changes changes) (sync-file (:current-file-id state) file-id :colors (:id color)) @@ -259,7 +259,7 @@ changes (-> (pcb/empty-changes it) (pcb/with-library-data data) (pcb/update-typography typography)) - undo-id (uuid/next)] + undo-id (js/Symbol)] (rx/of (dwu/start-undo-transaction undo-id) (dch/commit-changes changes) (sync-file (:current-file-id state) file-id :typographies (:id typography)) @@ -650,7 +650,7 @@ (let [current-file-id (:current-file-id state) page (wsh/lookup-page state) shape (ctn/get-shape page shape-id) - undo-id (uuid/next)] + undo-id (js/Symbol)] (rx/of (dwu/start-undo-transaction undo-id) (update-component shape-id) @@ -664,7 +664,7 @@ (ptk/reify ::update-component-in-bulk ptk/WatchEvent (watch [_ _ _] - (let [undo-id (uuid/next)] + (let [undo-id (js/Symbol)] (rx/concat (rx/of (dwu/start-undo-transaction undo-id)) (rx/map #(update-component-sync (:id %) file-id) (rx/from shapes)) diff --git a/frontend/src/app/main/data/workspace/modifiers.cljs b/frontend/src/app/main/data/workspace/modifiers.cljs index 4df2a1353..79f1fb2db 100644 --- a/frontend/src/app/main/data/workspace/modifiers.cljs +++ b/frontend/src/app/main/data/workspace/modifiers.cljs @@ -18,7 +18,6 @@ [app.common.types.modifiers :as ctm] [app.common.types.shape :as cts] [app.common.types.shape.layout :as ctl] - [app.common.uuid :as uuid] [app.main.data.workspace.changes :as dch] [app.main.data.workspace.comments :as-alias dwcm] [app.main.data.workspace.guides :as-alias dwg] @@ -343,7 +342,7 @@ shapes (map (d/getf objects) ids) ignore-tree (->> (map #(get-ignore-tree object-modifiers objects %) shapes) (reduce merge {})) - undo-id (uuid/next)] + undo-id (js/Symbol)] (rx/concat (if undo-transation? diff --git a/frontend/src/app/main/data/workspace/selection.cljs b/frontend/src/app/main/data/workspace/selection.cljs index 838f21812..8ff0d6668 100644 --- a/frontend/src/app/main/data/workspace/selection.cljs +++ b/frontend/src/app/main/data/workspace/selection.cljs @@ -561,7 +561,7 @@ frames (into #{} (map #(get-in objects [% :frame-id])) selected) - undo-id (uuid/next)] + undo-id (js/Symbol)] (rx/concat (->> (rx/from dup-frames) diff --git a/frontend/src/app/main/data/workspace/shapes.cljs b/frontend/src/app/main/data/workspace/shapes.cljs index 12d6f5e1d..72b3375f7 100644 --- a/frontend/src/app/main/data/workspace/shapes.cljs +++ b/frontend/src/app/main/data/workspace/shapes.cljs @@ -380,7 +380,7 @@ (cond-> (not= frame-id uuid/zero) (assoc :fills [] :hide-in-viewer true)) (cts/setup-rect-selrect)) - undo-id (uuid/next)] + undo-id (js/Symbol)] (rx/of (dwu/start-undo-transaction undo-id) (add-shape shape) diff --git a/frontend/src/app/main/data/workspace/transforms.cljs b/frontend/src/app/main/data/workspace/transforms.cljs index 371ddd731..81e8811c7 100644 --- a/frontend/src/app/main/data/workspace/transforms.cljs +++ b/frontend/src/app/main/data/workspace/transforms.cljs @@ -20,7 +20,6 @@ [app.common.types.modifiers :as ctm] [app.common.types.shape-tree :as ctst] [app.common.types.shape.layout :as ctl] - [app.common.uuid :as uuid] [app.main.data.workspace.changes :as dch] [app.main.data.workspace.collapse :as dwc] [app.main.data.workspace.modifiers :as dwm] @@ -509,7 +508,7 @@ (rx/last) (rx/mapcat (fn [[_ target-frame drop-index]] - (let [undo-id (uuid/next)] + (let [undo-id (js/Symbol)] (rx/of (dwu/start-undo-transaction undo-id) (move-shapes-to-frame ids target-frame drop-index) (dwm/apply-modifiers {:undo-transation? false}) diff --git a/frontend/src/app/main/ui/workspace/sidebar/assets.cljs b/frontend/src/app/main/ui/workspace/sidebar/assets.cljs index d29c5c903..6a287f580 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/assets.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/assets.cljs @@ -12,7 +12,6 @@ [app.common.pages.helpers :as cph] [app.common.spec :as us] [app.common.text :as txt] - [app.common.uuid :as uuid] [app.config :as cf] [app.main.data.events :as ev] [app.main.data.modal :as modal] @@ -182,7 +181,7 @@ (defn- create-assets-group [rename components-to-group group-name] - (let [undo-id (uuid/next)] + (let [undo-id (js/Symbol)] (st/emit! (dwu/start-undo-transaction undo-id)) (apply st/emit! (->> components-to-group @@ -594,7 +593,7 @@ (mf/use-fn (mf/deps @state) (fn [] - (let [undo-id (uuid/next)] + (let [undo-id (js/Symbol)] (if (empty? selected-components) (st/emit! (dwl/duplicate-component {:id (:component-id @state)})) (do @@ -606,7 +605,7 @@ (mf/use-fn (mf/deps @state file-id multi-components? multi-assets?) (fn [] - (let [undo-id (uuid/next)] + (let [undo-id (js/Symbol)] (if (or multi-components? multi-assets?) (on-assets-delete) (st/emit! (dwu/start-undo-transaction undo-id) @@ -653,7 +652,7 @@ (mf/deps components selected-components on-clear-selection) (fn [group-name] (on-clear-selection) - (let [undo-id (uuid/next)] + (let [undo-id (js/Symbol)] (st/emit! (dwu/start-undo-transaction undo-id)) (apply st/emit! (->> components @@ -670,7 +669,7 @@ (mf/deps components) (fn [path last-path] (on-clear-selection) - (let [undo-id (uuid/next)] + (let [undo-id (js/Symbol)] (st/emit! (dwu/start-undo-transaction undo-id)) (apply st/emit! (->> components @@ -701,7 +700,7 @@ (mf/deps components) (fn [path] (on-clear-selection) - (let [undo-id (uuid/next)] + (let [undo-id (js/Symbol)] (st/emit! (dwu/start-undo-transaction undo-id)) (apply st/emit! (->> components @@ -1029,7 +1028,7 @@ (mf/deps objects selected-objects on-clear-selection) (fn [group-name] (on-clear-selection) - (let [undo-id (uuid/next)] + (let [undo-id (js/Symbol)] (st/emit! (dwu/start-undo-transaction undo-id)) (apply st/emit! (->> objects @@ -1046,7 +1045,7 @@ (mf/deps objects) (fn [path last-path] (on-clear-selection) - (let [undo-id (uuid/next)] + (let [undo-id (js/Symbol)] (st/emit! (dwu/start-undo-transaction undo-id)) (apply st/emit! (->> objects @@ -1076,7 +1075,7 @@ (mf/deps objects) (fn [path] (on-clear-selection) - (let [undo-id (uuid/next)] + (let [undo-id (js/Symbol)] (st/emit! (dwu/start-undo-transaction undo-id)) (apply st/emit! (->> objects @@ -1193,7 +1192,7 @@ (fn [] (if (or multi-colors? multi-assets?) (on-assets-delete) - (let [undo-id (uuid/next)] + (let [undo-id (js/Symbol)] (st/emit! (dwu/start-undo-transaction undo-id) (dwl/delete-color color) (dwl/sync-file file-id file-id :colors (:id color)) @@ -1458,7 +1457,7 @@ (fn [color-id] (fn [group-name] (on-clear-selection) - (let [undo-id (uuid/next)] + (let [undo-id (js/Symbol)] (st/emit! (dwu/start-undo-transaction undo-id)) (apply st/emit! (->> colors @@ -1476,7 +1475,7 @@ (mf/deps colors) (fn [path last-path] (on-clear-selection) - (let [undo-id (uuid/next)] + (let [undo-id (js/Symbol)] (st/emit! (dwu/start-undo-transaction undo-id)) (apply st/emit! (->> colors @@ -1508,7 +1507,7 @@ (mf/deps colors) (fn [path] (on-clear-selection) - (let [undo-id (uuid/next)] + (let [undo-id (js/Symbol)] (st/emit! (dwu/start-undo-transaction undo-id)) (apply st/emit! (->> colors @@ -1757,7 +1756,7 @@ (mf/deps typographies selected-typographies on-clear-selection file-id) (fn [group-name] (on-clear-selection) - (let [undo-id (uuid/next)] + (let [undo-id (js/Symbol)] (st/emit! (dwu/start-undo-transaction undo-id)) (apply st/emit! (->> typographies @@ -1775,7 +1774,7 @@ (mf/deps typographies) (fn [path last-path] (on-clear-selection) - (let [undo-id (uuid/next)] + (let [undo-id (js/Symbol)] (st/emit! (dwu/start-undo-transaction undo-id)) (apply st/emit! (->> typographies @@ -1806,7 +1805,7 @@ (mf/deps typographies) (fn [path] (on-clear-selection) - (let [undo-id (uuid/next)] + (let [undo-id (js/Symbol)] (st/emit! (dwu/start-undo-transaction undo-id)) (apply st/emit! (->> typographies @@ -1844,7 +1843,7 @@ (mf/use-fn (mf/deps @state multi-typographies? multi-assets?) (fn [] - (let [undo-id (uuid/next)] + (let [undo-id (js/Symbol)] (if (or multi-typographies? multi-assets?) (on-assets-delete) (st/emit! (dwu/start-undo-transaction undo-id) @@ -2088,7 +2087,7 @@ (mf/use-fn (mf/deps selected-assets) (fn [] - (let [undo-id (uuid/next)] + (let [undo-id (js/Symbol)] (st/emit! (dwu/start-undo-transaction undo-id)) (apply st/emit! (map #(dwl/delete-component {:id %}) (:components selected-assets))) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs index 937e8be36..5a5c584f9 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs @@ -10,7 +10,6 @@ [app.common.geom.shapes :as gsh] [app.common.types.shape.layout :as ctl] [app.common.types.shape.radius :as ctsr] - [app.common.uuid :as uuid] [app.main.constants :refer [size-presets]] [app.main.data.workspace :as udw] [app.main.data.workspace.changes :as dch] @@ -250,7 +249,7 @@ (mf/deps ids) (fn [event] (let [value (-> event dom/get-target dom/checked?) - undo-id (uuid/next)] + undo-id (js/Symbol)] (do (st/emit! (dwu/start-undo-transaction undo-id) (dch/update-shapes ids (fn [shape] (assoc shape :hide-in-viewer (not value)))))