fix reloading of views
This commit is contained in:
parent
27667dd949
commit
34f8031d9f
|
@ -315,10 +315,11 @@
|
|||
|
||||
(defonce rand-label (rand/id))
|
||||
|
||||
(defonce main-component (atom nil))
|
||||
(defonce initial-view-id (atom nil))
|
||||
|
||||
(defn main []
|
||||
(let [view-id (re-frame/subscribe [:get :view-id])]
|
||||
(let [view-id (re-frame/subscribe [:get :view-id])
|
||||
main-component (atom nil)]
|
||||
(reagent/create-class
|
||||
{:component-did-mount
|
||||
(fn []
|
||||
|
@ -326,14 +327,30 @@
|
|||
(utils.universal-links/initialize))
|
||||
:component-will-mount
|
||||
(fn []
|
||||
(when (and @view-id (not @main-component))
|
||||
(reset! main-component (get-main-component2 @view-id))))
|
||||
(when-not @initial-view-id
|
||||
(reset! initial-view-id @view-id))
|
||||
(when (and @initial-view-id
|
||||
(or
|
||||
js/goog.DEBUG
|
||||
(not @main-component)))
|
||||
(reset! main-component (get-main-component2
|
||||
(if js/goog.DEBUG
|
||||
@initial-view-id
|
||||
@view-id)))))
|
||||
:component-will-unmount
|
||||
utils.universal-links/finalize
|
||||
:component-will-update
|
||||
(fn []
|
||||
(when (and @view-id (not @main-component))
|
||||
(reset! main-component (get-main-component2 @view-id)))
|
||||
(when-not @initial-view-id
|
||||
(reset! initial-view-id @view-id))
|
||||
(when (and @initial-view-id
|
||||
(or
|
||||
js/goog.DEBUG
|
||||
(not @main-component)))
|
||||
(reset! main-component (get-main-component2
|
||||
(if js/goog.DEBUG
|
||||
@initial-view-id
|
||||
@view-id))))
|
||||
(react/dismiss-keyboard!))
|
||||
:component-did-update
|
||||
(fn []
|
||||
|
|
Loading…
Reference in New Issue