Skip to content

Commit 8072ad9

Browse files
committed
Fix path indexes after max-number-body-items
1 parent b1a28d3 commit 8072ad9

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

src/lib/devtools/formatters/markup.cljs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@
179179
;; a sequence or map as the second item when the path info is not nil.
180180
;; are all just seq'd maps and that the first item in the vector is a key in the map.
181181
;; The seq'd map is a result of `(seq value)` done in `body-lines` above
182-
(devtools.formatters.state/push-object-to-current-history! value)
182+
(devtools.formatters.state/push-object-to-current-history! (with-meta value {:index starting-index}))
183183
(let [has-continuation? (pos? starting-index)
184184
body-markup (<standard-body> (body-lines value starting-index) has-continuation?)]
185185
(if has-continuation?

src/lib/devtools/formatters/state.cljs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,28 @@
4949
(defn get-second-last-object-from-current-history []
5050
(second (get-current-history))) ; note the list is reversed
5151

52-
(defn present-path-segment [v]
52+
(defn present-path-segment [v & [starting-index]]
5353
(cond
5454
(string? v) v
5555
;; we'd like to preserve keywords for easy get
5656
(keyword? v) v
57+
(and (number? v)
58+
(number? starting-index)) (+ v starting-index) ;; ensures indexing in very large objects
5759
(number? v) v
5860
:else "?"))
5961

6062
(defn seek-path-segment [coll val & [seq'd-map?]]
61-
(let [* (fn [[k v]]
62-
(cond
63-
;; we need to know the paths for keywords, these are clickable
64-
(and seq'd-map? (identical? k val))
65-
(present-path-segment k)
66-
67-
(identical? v val)
68-
(present-path-segment k)))]
63+
(let [starting-index (-> (get-last-object-from-current-history)
64+
(meta)
65+
:index)
66+
* (fn [[k v]]
67+
(cond
68+
;; we need to know the paths for keywords, these are clickable
69+
(and seq'd-map? (identical? k val))
70+
(present-path-segment k)
71+
72+
(identical? v val)
73+
(present-path-segment k starting-index)))]
6974
(some * coll)))
7075

7176
(defn build-path-segment [parent-object object]

0 commit comments

Comments
 (0)