🐛 Fix problem with preview version in svg render (#9626)

This commit is contained in:
Alonso Torres 2026-05-14 11:11:01 +02:00 committed by GitHub
parent eec05271e0
commit c752e194d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 12 deletions

View File

@ -34,12 +34,14 @@
on-accept
(mf/use-fn
(mf/deps on-accept)
(fn [e]
(when (fn? on-accept)
(on-accept e))))
on-cancel
(mf/use-fn
(mf/deps on-cancel)
(fn [e]
(when on-cancel (on-cancel e))))]

View File

@ -60,10 +60,11 @@
{::mf/wrap [mf/memo]
::mf/wrap-props false}
[props]
(let [objects (obj/get props "objects")
active-frames (obj/get props "active-frames")
shapes (cfh/get-immediate-children objects)
vbox (mf/use-ctx ctx/current-vbox)
(let [objects (obj/get props "objects")
active-frames (obj/get props "active-frames")
disable-thumbnails (obj/get props "disable-thumbnails")
shapes (cfh/get-immediate-children objects)
vbox (mf/use-ctx ctx/current-vbox)
frame-overlap? (mf/with-memo [vbox objects]
#(make-is-frame-overlap vbox objects))
@ -84,13 +85,16 @@
[:g.frame-children
(for [shape shapes]
[:g.ws-shape-wrapper {:key (dm/str (dm/get-prop shape :id))}
(if ^boolean (cfh/frame-shape? shape)
[:& root-frame-wrapper
{:shape shape
:objects objects
:thumbnail? (not (contains? active-frames (dm/get-prop shape :id)))}]
[:& shape-wrapper {:shape shape}])])]]]))
(let [thumbnail?
(and (not disable-thumbnails)
(contains? active-frames (dm/get-prop shape :id)))]
[:g.ws-shape-wrapper {:key (dm/str (dm/get-prop shape :id))}
(if ^boolean (cfh/frame-shape? shape)
[:& root-frame-wrapper
{:shape shape
:objects objects
:thumbnail? thumbnail?}]
[:& shape-wrapper {:shape shape}])]))]]]))
(mf/defc shape-wrapper
{::mf/wrap [#(mf/memo' % common/check-shape-props)]

View File

@ -410,7 +410,9 @@
;; Render root shape
[:& shapes/root-shape {:key (str page-id)
:objects base-objects
:active-frames @active-frames}]]]]
:active-frames @active-frames
;; disable thumbnails when previewing a version
:disable-thumbnails (some? preview-id)}]]]]
[:svg.viewport-controls
{:xmlns "http://www.w3.org/2000/svg"