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

🐛 Fix problem with thumbnails

This commit is contained in:
alonso.torres 2022-05-18 17:04:59 +02:00
parent 1690f1ee23
commit 2b1e126ff8

View file

@ -46,12 +46,14 @@
(defn- remove-embed-images-changes (defn- remove-embed-images-changes
"Remove the changes related to change a url for its embed value. This is necessary "Remove the changes related to change a url for its embed value. This is necessary
so we don't have to recalculate the thumbnail when the image loads." so we don't have to recalculate the thumbnail when the image loads."
[changes] [value]
(->> changes (if (.isArray js/Array value)
(remove (fn [change] (->> value
(and (= "attributes" (.-type change)) (remove (fn [change]
(= "href" (.-attributeName change)) (and (= "attributes" (.-type change))
(str/starts-with? (.-oldValue change) "http")))))) (= "href" (.-attributeName change))
(str/starts-with? (.-oldValue change) "http")))))
[value]))
(defn use-render-thumbnail (defn use-render-thumbnail
"Hook that will create the thumbnail thata" "Hook that will create the thumbnail thata"
@ -121,6 +123,7 @@
(rx/map remove-embed-images-changes) (rx/map remove-embed-images-changes)
(rx/filter d/not-empty?) (rx/filter d/not-empty?)
(rx/debounce 400) (rx/debounce 400)
(rx/catch (fn [err] (.error js/console err)))
(rx/subs on-update-frame))] (rx/subs on-update-frame))]
#(rx/dispose! subid)))) #(rx/dispose! subid))))