Skip to content

Commit 78cc711

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 3749b0d commit 78cc711

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/cider/nrepl/middleware/inspect.clj

+3-5
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@
1010
(:import
1111
nrepl.transport.Transport))
1212

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

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

7775
(defn get-path-reply [{:keys [session] :as msg}]
78-
(:path (get session #'*inspector*)))
76+
(get-in (meta session) [::inspector :path]))
7977

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

0 commit comments

Comments
 (0)