fix red screen on hot reloading

Signed-off-by: yenda <eric@status.im>
This commit is contained in:
yenda 2019-09-03 11:07:50 +02:00
parent 45be9b66db
commit 3ef0433d7b
No known key found for this signature in database
GPG Key ID: 0095623C0069DCE6
1 changed files with 13 additions and 13 deletions

View File

@ -101,22 +101,22 @@
main-component (atom nil)
main-component-two-pane (atom nil)
two-pane? (reagent/atom (dimensions/fit-two-pane?))]
(.addEventListener react/dimensions
"change"
(fn [dimensions]
(let [two-pane-enabled? (dimensions/fit-two-pane?)]
(do
(re-frame/dispatch [:set-two-pane-ui-enabled two-pane-enabled?])
(log/debug ":set-two-pane " two-pane-enabled?)
(reset! two-pane? two-pane-enabled?)))))
(when-not @initial-view-id
(reset! initial-view-id @view-id))
(reset-component-on-mount view-id main-component false)
(reset-component-on-mount view-id main-component-two-pane true)
(reagent/create-class
{:component-did-mount
(fn []
(.addEventListener react/dimensions
"change"
(fn [dimensions]
(let [two-pane-enabled? (dimensions/fit-two-pane?)]
(do
(re-frame/dispatch [:set-two-pane-ui-enabled two-pane-enabled?])
(log/debug ":set-two-pane " two-pane-enabled?)
(reset! two-pane? two-pane-enabled?)))))
(when-not @initial-view-id
(reset! initial-view-id @view-id))
(reset-component-on-mount view-id main-component false)
(reset-component-on-mount view-id main-component-two-pane true)
(re-frame/dispatch [:set-two-pane-ui-enabled @two-pane?])
(log/debug :main-component-did-mount @view-id)
(utils.universal-links/initialize))