mirror of
https://github.com/penpot/penpot.git
synced 2025-01-26 08:29:42 -05:00
🐛 Fix imposter being regenerated indefinitely
This commit is contained in:
parent
2465690c7d
commit
9ad0662409
3 changed files with 17 additions and 15 deletions
|
@ -808,7 +808,7 @@
|
||||||
component (ctkl/get-component data component-id)
|
component (ctkl/get-component data component-id)
|
||||||
page-id (:main-instance-page component)
|
page-id (:main-instance-page component)
|
||||||
root-id (:main-instance-id component)]
|
root-id (:main-instance-id component)]
|
||||||
(dwt/request-thumbnail file-id page-id root-id tag)))
|
(dwt/request-thumbnail file-id page-id root-id tag "update-component-thumbnail-sync")))
|
||||||
|
|
||||||
(defn update-component-sync
|
(defn update-component-sync
|
||||||
([shape-id file-id] (update-component-sync shape-id file-id nil))
|
([shape-id file-id] (update-component-sync shape-id file-id nil))
|
||||||
|
|
|
@ -58,15 +58,17 @@
|
||||||
|
|
||||||
(defn request-thumbnail
|
(defn request-thumbnail
|
||||||
"Enqueues a request to generate a thumbnail for the given ids."
|
"Enqueues a request to generate a thumbnail for the given ids."
|
||||||
[file-id page-id shape-id tag]
|
([file-id page-id shape-id tag]
|
||||||
(ptk/reify ::request-thumbnail
|
(request-thumbnail file-id page-id shape-id tag "unknown"))
|
||||||
ptk/EffectEvent
|
([file-id page-id shape-id tag requester]
|
||||||
(effect [_ _ _]
|
(ptk/reify ::request-thumbnail
|
||||||
(l/dbg :hint "request thumbnail" :file-id file-id :page-id page-id :shape-id shape-id :tag tag)
|
ptk/EffectEvent
|
||||||
(q/enqueue-unique
|
(effect [_ _ _]
|
||||||
queue
|
(l/dbg :hint "request thumbnail" :requester requester :file-id file-id :page-id page-id :shape-id shape-id :tag tag)
|
||||||
(create-request file-id page-id shape-id tag)
|
(q/enqueue-unique
|
||||||
(partial find-request file-id page-id shape-id tag)))))
|
queue
|
||||||
|
(create-request file-id page-id shape-id tag)
|
||||||
|
(partial find-request file-id page-id shape-id tag))))))
|
||||||
|
|
||||||
;; This function first renders the HTML calling `render/render-frame` that
|
;; This function first renders the HTML calling `render/render-frame` that
|
||||||
;; returns HTML as a string, then we send that data to the iframe rasterizer
|
;; returns HTML as a string, then we send that data to the iframe rasterizer
|
||||||
|
@ -291,6 +293,6 @@
|
||||||
(->> all-changes-s
|
(->> all-changes-s
|
||||||
(rx/buffer-until notifier-s)
|
(rx/buffer-until notifier-s)
|
||||||
(rx/mapcat #(into #{} %))
|
(rx/mapcat #(into #{} %))
|
||||||
(rx/map #(request-thumbnail file-id page-id % "frame"))))
|
(rx/map #(request-thumbnail file-id page-id % "frame" "watch-state-changes"))))
|
||||||
|
|
||||||
(rx/take-until stopper-s))))))
|
(rx/take-until stopper-s))))))
|
||||||
|
|
|
@ -107,9 +107,9 @@
|
||||||
(-> (image-size href)
|
(-> (image-size href)
|
||||||
(p/then
|
(p/then
|
||||||
(fn [{:keys [width height]}]
|
(fn [{:keys [width height]}]
|
||||||
(when (or (not (mth/close? width fixed-width 2))
|
(when (or (not (mth/close? width fixed-width 5))
|
||||||
(not (mth/close? height fixed-height 2)))
|
(not (mth/close? height fixed-height 5)))
|
||||||
(st/emit! (dwt/request-thumbnail file-id page-id frame-id "frame"))))))))
|
(st/emit! (dwt/request-thumbnail file-id page-id frame-id "frame" "check-thumbnail-size"))))))))
|
||||||
|
|
||||||
(defn root-frame-wrapper-factory
|
(defn root-frame-wrapper-factory
|
||||||
[shape-wrapper]
|
[shape-wrapper]
|
||||||
|
@ -175,7 +175,7 @@
|
||||||
(mf/with-effect []
|
(mf/with-effect []
|
||||||
(when-not (some? thumbnail-uri)
|
(when-not (some? thumbnail-uri)
|
||||||
(tm/schedule-on-idle
|
(tm/schedule-on-idle
|
||||||
#(st/emit! (dwt/request-thumbnail file-id page-id frame-id "frame"))))
|
#(st/emit! (dwt/request-thumbnail file-id page-id frame-id "frame" "root-frame"))))
|
||||||
#(when-let [task (mf/ref-val task-ref)]
|
#(when-let [task (mf/ref-val task-ref)]
|
||||||
(d/close! task)))
|
(d/close! task)))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue