Skip to content

Commit 14cee68

Browse files
committed
Use session metadata for inspector state
The bindings map is no longer reliably updated due to changes in nREPL – it is now possible for the inspector state to be overwritten if we use it. Use the session's metadata instead (as the session middleware itself does).
1 parent 5cf3fc0 commit 14cee68

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/cider/nrepl/middleware/inspect.clj

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@
99
(:import
1010
nrepl.transport.Transport))
1111

12-
(def ^:dynamic *inspector* (inspect/fresh))
13-
1412
(defn swap-inspector!
1513
[{:keys [session] :as msg} f & args]
1614
(-> session
17-
(swap! update-in [#'*inspector*] #(apply f % args))
18-
(get #'*inspector*)))
15+
(alter-meta! update ::inspector #(apply f % args))
16+
(get ::inspector)))
1917

2018
(defn inspect-reply
2119
[{:keys [page-size transport] :as msg} eval-response]
@@ -74,7 +72,7 @@
7472
(inspector-response msg (swap-inspector! msg #(or % (inspect/fresh)))))
7573

7674
(defn get-path-reply [{:keys [session] :as msg}]
77-
(:path (get session #'*inspector*)))
75+
(get-in (meta session) [::inspector :path]))
7876

7977
(defn next-page-reply [msg]
8078
(inspector-response msg (swap-inspector! msg inspect/next-page)))

0 commit comments

Comments
 (0)