mirror of
https://github.com/penpot/penpot.git
synced 2025-04-15 08:21:40 -05:00
🐛 Prevent memory leak warning on deffered component.
This commit is contained in:
parent
9c73444102
commit
b4b88bde0b
1 changed files with 5 additions and 1 deletions
|
@ -20,6 +20,7 @@
|
|||
[app.main.ui.workspace.effects :as we]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.timers :as ts]
|
||||
[beicon.core :as rx]
|
||||
[okulary.core :as l]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
|
@ -102,7 +103,10 @@
|
|||
(let [tmp (mf/useState false)
|
||||
^boolean render? (aget tmp 0)
|
||||
^js set-render (aget tmp 1)]
|
||||
(mf/use-layout-effect (fn [] (ts/schedule-on-idle #(set-render true))))
|
||||
(mf/use-layout-effect
|
||||
(fn []
|
||||
(let [sem (ts/schedule-on-idle #(set-render true))]
|
||||
#(rx/dispose! sem))))
|
||||
(if (unchecked-get props "ghost?")
|
||||
(mf/create-element component props)
|
||||
(when render? (mf/create-element component props))))))
|
||||
|
|
Loading…
Add table
Reference in a new issue