Skip to content

Commit bb6fe7c

Browse files
[inspect] Don't allow table-viewing maps
1 parent c290435 commit bb6fe7c

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/orchard/inspect.clj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,9 +427,9 @@
427427
(defn supports-table-view-mode?
428428
"Return whether the inspected object can be rendered in :table view-mode."
429429
[{:keys [chunk value] :as _inspector}]
430-
(let [val (or chunk value)]
431-
(and (#{:list :array} (object-type val))
432-
(#{:list :array :map} (object-type (first val))))))
430+
(let [chunk (or chunk value)]
431+
(and (#{:list :array} (object-type value))
432+
(#{:list :array :map} (object-type (first chunk))))))
433433

434434
(defn- render-chunk-as-table [inspector chunk idx-starts-from]
435435
(let [m-i map-indexed

test/orchard/inspect_test.clj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1566,7 +1566,13 @@
15661566
" | " [:value "7" pos?] " | " [:value "7" pos?] " | " [:value "7" pos?] " | " [:newline]
15671567
" | " [:value "8" pos?] " | " [:value "8" pos?] " | " [:value "8" pos?] " | " [:newline]
15681568
[:newline]]
1569-
(section "Contents" rendered)))))
1569+
(section "Contents" rendered))))
1570+
1571+
(testing "map is not reported as table-viewable when paged"
1572+
(is (not (-> (zipmap (range 100) (range))
1573+
(inspect/start)
1574+
(set-page-size 30)
1575+
(inspect/supports-table-view-mode?))))))
15701576

15711577
(deftest pretty-print-map-test
15721578
(testing "in :pretty view-mode are pretty printed"

0 commit comments

Comments
 (0)