0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-23 07:16:07 -05:00

🐛 Fix Old thumbnail present after component sync

This commit is contained in:
Pablo Alba 2023-11-29 18:35:26 +01:00 committed by Andrés Moya
parent 05a392d093
commit 20a86ad65a

View file

@ -944,7 +944,20 @@
(when sync-typographies?
(dwlh/generate-sync-file it file-id :typographies asset-id library-id state))])
changes (pcb/concat-changes library-changes file-changes)]
changes (pcb/concat-changes library-changes file-changes)
find-shape (fn [data]
(for [page-id [(:page-id data)]
id (:shapes data)]
(-> (get-in state [:workspace-data :pages-index page-id :objects id])
(assoc :page-id page-id))))
updated-copies (->> changes
:redo-changes
(filter #(= (:type %) :reg-objects))
(mapcat find-shape)
(filter ctk/instance-head?)
distinct)]
(log/debug :msg "SYNC-FILE finished" :js/rchanges (log-changes
(:redo-changes changes)
@ -955,6 +968,13 @@
(when (seq (:redo-changes changes))
(rx/of (dch/commit-changes (assoc changes ;; TODO a ver qué pasa con esto
:file-id file-id))))
(when-not (empty? updated-copies)
(->> (rx/from updated-copies)
(rx/mapcat (fn [shape]
(rx/of
(dwt/clear-thumbnail file-id (:page-id shape) (:id shape) "frame")
(when-not (= (:frame-id shape) uuid/zero)
(dwt/clear-thumbnail file-id (:page-id shape) (:frame-id shape) "frame")))))))
(when (not= file-id library-id)
;; When we have just updated the library file, give some time for the
;; update to finish, before marking this file as synced.