0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-14 19:19:09 -05:00

🐛 Fix idempotency problem on fdata migration 25

This commit is contained in:
Andrey Antukh 2024-02-22 13:01:43 +01:00
parent dec622600d
commit 0999ecb2a9
2 changed files with 8 additions and 5 deletions

View file

@ -492,9 +492,11 @@
[data] [data]
(some-> cfeat/*new* (swap! conj "fdata/shape-data-type")) (some-> cfeat/*new* (swap! conj "fdata/shape-data-type"))
(letfn [(update-object [object] (letfn [(update-object [object]
(-> object (if (cfh/root? object)
(d/update-when :selrect grc/make-rect) object
(cts/map->Shape))) (-> object
(update :selrect grc/make-rect)
(cts/map->Shape))))
(update-container [container] (update-container [container]
(d/update-when container :objects update-vals update-object))] (d/update-when container :objects update-vals update-object))]
(-> data (-> data

View file

@ -63,10 +63,11 @@
(make-rect x1 y1 (- x2 x1) (- y2 y1)))) (make-rect x1 y1 (- x2 x1) (- y2 y1))))
([x y width height] ([x y width height]
(when (d/num? x y width height) (if (d/num? x y width height)
(let [w (mth/max width 0.01) (let [w (mth/max width 0.01)
h (mth/max height 0.01)] h (mth/max height 0.01)]
(pos->Rect x y w h x y (+ x w) (+ y h)))))) (pos->Rect x y w h x y (+ x w) (+ y h)))
(make-rect))))
(def ^:private schema:rect-attrs (def ^:private schema:rect-attrs
[:map {:title "RectAttrs"} [:map {:title "RectAttrs"}