Improve path rendering performance.

This commit is contained in:
Andrey Antukh 2022-01-21 14:48:33 +01:00
parent bc04a0b9f0
commit 3d6c903273
5 changed files with 101 additions and 102 deletions

View file

@ -20,21 +20,18 @@
[props]
(let [shape (unchecked-get props "shape")
content (:content shape)
pdata (mf/use-memo
(mf/deps content)
(fn []
(try
(upf/format-path content)
(catch :default e
(log/error :hint "unexpected error on formating path"
:shape-name (:name shape)
:shape-id (:id shape)
:cause e)
""))))
pdata (mf/with-memo [content]
(try
(upf/format-path content)
(catch :default e
(log/error :hint "unexpected error on formating path"
:shape-name (:name shape)
:shape-id (:id shape)
:cause e)
"")))
props (-> (attrs/extract-style-attrs shape)
(obj/merge!
#js {:d pdata}))]
(obj/set! "d" pdata))]
[:& shape-custom-stroke {:shape shape}
[:> :path props]]))