From 51a9b10d51f3d37bb71285b173b018497ac40416 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 23 May 2022 12:00:46 +0200 Subject: [PATCH] :bug: Fix problem when initializing texts --- .../ui/workspace/shapes/text/viewport_texts.cljs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/shapes/text/viewport_texts.cljs b/frontend/src/app/main/ui/workspace/shapes/text/viewport_texts.cljs index 28c8b5f21..450c72070 100644 --- a/frontend/src/app/main/ui/workspace/shapes/text/viewport_texts.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/text/viewport_texts.cljs @@ -41,7 +41,10 @@ (not (gsh/empty-modifiers? (:modifiers modifier))) (-> (assoc :grow-type :fixed) (merge modifier) gsh/transform-shape))] - (strip-position-data shape))) + (-> shape + (cond-> (nil? (:position-data shape)) + (assoc :migrate true)) + strip-position-data))) (defn- update-with-editor-state "Updates the shape with the current state in the editor" @@ -127,9 +130,14 @@ new-shape (get text-shapes id) old-modifiers (-> (get prev-modifiers id) strip-modifier) new-modifiers (-> (get modifiers id) strip-modifier)] + (or (and (not (identical? old-shape new-shape)) - (not= old-shape new-shape)) - (not= new-modifiers old-modifiers)))) + (not= (dissoc old-shape :migrate :position-data) + (dissoc new-shape :migrate :position-data))) + (not= new-modifiers old-modifiers) + + ;; When the position data is nil we force to recalculate + (:migrate new-shape)))) changed-texts (mf/use-memo