diff --git a/frontend/src/app/main/ui/hooks.cljs b/frontend/src/app/main/ui/hooks.cljs index c0748fe45..44a8595a9 100644 --- a/frontend/src/app/main/ui/hooks.cljs +++ b/frontend/src/app/main/ui/hooks.cljs @@ -20,6 +20,13 @@ [goog.functions :as f] [rumext.v2 :as mf])) +(def ^:private render-id 0) + +(defn use-render-id + "Get a stable, DOM usable identifier across all react rerenders" + [] + (mf/useMemo #(js* "\"render-\" + (++~{})" render-id) #js [])) + (defn use-rxsub [ob] (let [[state reset-state!] (mf/useState #(if (satisfies? IDeref ob) @ob nil))] diff --git a/frontend/src/app/main/ui/shapes/shape.cljs b/frontend/src/app/main/ui/shapes/shape.cljs index 45a3bc0fe..659ce9f23 100644 --- a/frontend/src/app/main/ui/shapes/shape.cljs +++ b/frontend/src/app/main/ui/shapes/shape.cljs @@ -11,6 +11,7 @@ [app.common.pages.helpers :as cph] [app.main.refs :as refs] [app.main.ui.context :as muc] + [app.main.ui.hooks :as h] [app.main.ui.shapes.attrs :as attrs] [app.main.ui.shapes.export :as ed] [app.main.ui.shapes.fills :as fills] @@ -63,7 +64,7 @@ (or (:blend-mode shape))) type (dm/get-prop shape :type) - render-id (mf/use-id) + render-id (h/use-render-id) filter-id (dm/str "filter_" render-id) styles (-> (obj/create) (obj/set! "pointerEvents" pointer-events)