Skip to content

Commit

Permalink
fix(http-server): apis server status for multiple graph windows
Browse files Browse the repository at this point in the history
  • Loading branch information
xyhp915 authored and tiensonqin committed Mar 6, 2023
1 parent 821e029 commit c83c973
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/electron/electron/server.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
[electron.utils :as utils]
[camel-snake-kebab.core :as csk]
[electron.logger :as logger]
[electron.configs :as cfgs]))
[electron.configs :as cfgs]
[electron.window :as window]))

(defonce ^:private *win (atom nil))
(defonce ^:private *server (atom nil))
Expand All @@ -37,7 +38,9 @@

(defn load-state-to-renderer!
([] (load-state-to-renderer! @*state))
([s] (utils/send-to-renderer @*win :syncAPIServerState s)))
([s]
(doseq [^js w (window/get-all-windows)]
(utils/send-to-renderer w :syncAPIServerState s))))

(defn set-config!
[config]
Expand Down Expand Up @@ -114,7 +117,7 @@

(defn close!
[]
(when (and @*server (= :running (:status @*state)))
(when (and @*server (contains? #{:running :error} (:status @*state)))
(logger/debug "[server] closing ...")
(set-status! :closing)
(-> (.close @*server)
Expand Down
1 change: 0 additions & 1 deletion src/main/frontend/components/server.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,3 @@
(if-not running?
(string/upper-case (or (:status server-state) "stopped"))
[:a.hover:underline {:href href} href])]]})]))

0 comments on commit c83c973

Please sign in to comment.