mirror of
https://github.com/penpot/penpot.git
synced 2025-01-06 14:50:20 -05:00
Fix initialization order of the application.
This commit is contained in:
parent
b317ee4904
commit
0fc77d0283
3 changed files with 14 additions and 9 deletions
|
@ -1,7 +1,7 @@
|
|||
(ns uxbox.core
|
||||
(:require [beicon.core :as rx]
|
||||
[uxbox.router]
|
||||
[uxbox.state :as s]
|
||||
[uxbox.router :as r]
|
||||
[uxbox.rstore :as rs]
|
||||
[uxbox.ui :as ui]
|
||||
[uxbox.data.load :as dl]))
|
||||
|
@ -10,7 +10,8 @@
|
|||
|
||||
(defonce +setup+
|
||||
(do
|
||||
(println "bootstrap")
|
||||
(r/init)
|
||||
(ui/init)
|
||||
(rs/emit! (dl/load-data))
|
||||
(rx/on-value s/stream #(dl/persist-state %))
|
||||
1))
|
||||
(rx/on-value s/stream #(dl/persist-state %))))
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Events
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defn update-location
|
||||
[{:keys [handler route-params] :as params}]
|
||||
(reify
|
||||
|
@ -61,10 +60,14 @@
|
|||
["colors" :dashboard/colors]]]
|
||||
["workspace/" [[page-route :workspace/page]]]]])
|
||||
|
||||
(defonce +router+
|
||||
(def ^:static ^:private +router+ nil)
|
||||
|
||||
(defn init
|
||||
[]
|
||||
(let [opts {:on-navigate #(rs/emit! (update-location %))
|
||||
:default-location {:handler :dashboard/projects}}]
|
||||
(bidi.router/start-router! routes opts)))
|
||||
:default-location {:handler :dashboard/projects}}
|
||||
router (bidi.router/start-router! routes opts)]
|
||||
(set! +router+ router)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Public Api
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
(defn app-render
|
||||
[own]
|
||||
(let [{:keys [location location-params] :as state} (rum/react state)]
|
||||
(println "app-render" location state)
|
||||
(case location
|
||||
:auth/login (ui.users/login)
|
||||
:dashboard/projects (ui.dashboard.projects/projects)
|
||||
|
@ -42,5 +43,5 @@
|
|||
[]
|
||||
(let [app-dom (gdom/getElement "app")
|
||||
lb-dom (gdom/getElement "lightbox")]
|
||||
(util/mount (app) app-dom)
|
||||
(util/mount (ui.lb/lightbox) lb-dom)))
|
||||
(rum/mount (app) app-dom)
|
||||
(rum/mount (ui.lb/lightbox) lb-dom)))
|
||||
|
|
Loading…
Reference in a new issue