mirror of
https://github.com/penpot/penpot.git
synced 2025-06-01 01:51:38 +02:00
🐛 Properly dispose rx subscription on grid thumbnail component
This commit is contained in:
parent
05fac41534
commit
1194e40222
1 changed files with 10 additions and 8 deletions
|
@ -89,14 +89,16 @@
|
||||||
|
|
||||||
(mf/with-effect [file-id revn visible? thumbnail-id]
|
(mf/with-effect [file-id revn visible? thumbnail-id]
|
||||||
(when (and visible? (not thumbnail-id))
|
(when (and visible? (not thumbnail-id))
|
||||||
(->> (ask-for-thumbnail file-id revn)
|
(let [subscription
|
||||||
(rx/subs! (fn [thumbnail-id]
|
(->> (ask-for-thumbnail file-id revn)
|
||||||
(st/emit! (dd/set-file-thumbnail file-id thumbnail-id)))
|
(rx/subs! (fn [thumbnail-id]
|
||||||
(fn [cause]
|
(st/emit! (dd/set-file-thumbnail file-id thumbnail-id)))
|
||||||
(log/error :hint "unable to render thumbnail"
|
(fn [cause]
|
||||||
:file-if file-id
|
(log/error :hint "unable to render thumbnail"
|
||||||
:revn revn
|
:file-if file-id
|
||||||
:message (ex-message cause)))))))
|
:revn revn
|
||||||
|
:message (ex-message cause)))))]
|
||||||
|
(partial rx/dispose! subscription))))
|
||||||
|
|
||||||
[:div {:class (stl/css :grid-item-th)
|
[:div {:class (stl/css :grid-item-th)
|
||||||
:style {:background-color bg-color}
|
:style {:background-color bg-color}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue