mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 08:50:57 -05:00
✨ Changed order of plugins initialization
This commit is contained in:
parent
c70d20f95d
commit
fb1429956a
3 changed files with 20 additions and 15 deletions
|
@ -105,8 +105,7 @@
|
|||
(rx/map deref)
|
||||
(rx/filter du/is-authenticated?)
|
||||
(rx/take 1)
|
||||
(rx/map #(ws/initialize))
|
||||
(rx/tap #(plugins/init!)))))))
|
||||
(rx/map #(ws/initialize)))))))
|
||||
|
||||
(defn ^:export init
|
||||
[]
|
||||
|
@ -116,7 +115,8 @@
|
|||
(cur/init-styles)
|
||||
(thr/init!)
|
||||
(init-ui)
|
||||
(st/emit! (initialize)))
|
||||
(st/emit! (plugins/initialize)
|
||||
(initialize)))
|
||||
|
||||
(defn ^:export reinit
|
||||
([]
|
||||
|
|
|
@ -16,15 +16,20 @@
|
|||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn init!
|
||||
(defn init-plugins-runtime!
|
||||
[]
|
||||
(->> st/stream
|
||||
(rx/filter (ptk/type? ::features/initialize))
|
||||
(rx/take 1)
|
||||
;; We need to wait to the init event to finish
|
||||
(rx/observe-on :async)
|
||||
(rx/subs!
|
||||
(fn []
|
||||
(when (features/active-feature? @st/state "plugins/runtime")
|
||||
(when-let [init-runtime (obj/get global "initPluginsRuntime")]
|
||||
(init-runtime (fn [plugin-id] (api/create-context plugin-id)))))))))
|
||||
(init-runtime (fn [plugin-id] (api/create-context plugin-id)))))
|
||||
|
||||
(defn initialize
|
||||
[]
|
||||
(ptk/reify ::initialize
|
||||
ptk/WatchEvent
|
||||
(watch [_ _ stream]
|
||||
(->> stream
|
||||
(rx/filter (ptk/type? ::features/initialize))
|
||||
(rx/observe-on :async)
|
||||
(rx/filter #(features/active-feature? @st/state "plugins/runtime"))
|
||||
(rx/take 1)
|
||||
(rx/tap init-plugins-runtime!)
|
||||
(rx/ignore)))))
|
||||
|
|
|
@ -27,6 +27,6 @@
|
|||
|
||||
(defn ^:export plugins []
|
||||
(st/emit! (features/enable-feature "plugins/runtime"))
|
||||
(plugins/init!)
|
||||
(plugins/init-plugins-runtime!)
|
||||
nil)
|
||||
|
||||
|
|
Loading…
Reference in a new issue