From efd4a1ffba8662fa83bfe11a45f42c45a877fc22 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 6 Sep 2023 15:49:35 +0200 Subject: [PATCH] :sparkles: Fix inconsistencies on shapes/gradient component --- .../src/app/main/ui/shapes/gradients.cljs | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/frontend/src/app/main/ui/shapes/gradients.cljs b/frontend/src/app/main/ui/shapes/gradients.cljs index 11b92af6d9..2adcfd2676 100644 --- a/frontend/src/app/main/ui/shapes/gradients.cljs +++ b/frontend/src/app/main/ui/shapes/gradients.cljs @@ -101,17 +101,22 @@ (mf/defc gradient {::mf/wrap-props false} [props] - (let [attr (obj/get props "attr") - shape (obj/get props "shape") - id (obj/get props "id") - id' (mf/use-ctx muc/render-id) - id (or id (dm/str (name attr) "_" id')) + (let [attr (unchecked-get props "attr") + shape (unchecked-get props "shape") + id (unchecked-get props "id") + rid (mf/use-ctx muc/render-id) + + id (if (some? id) + id + (dm/str (name attr) "_" rid)) + gradient (get shape attr) - gradient-props #js {:id id - :gradient gradient - :shape shape}] - (when gradient - (case (d/name (:type gradient)) - "linear" [:> linear-gradient gradient-props] - "radial" [:> radial-gradient gradient-props] + props #js {:id id + :gradient gradient + :shape shape}] + + (when (some? gradient) + (case (:type gradient) + :linear [:> linear-gradient props] + :radial [:> radial-gradient props] nil))))