Files
ottyl/tickets/093-json-viewer-collapsed-by-default.md
T
2026-09-07 12:16:36 +01:00

1.6 KiB

093 — Log-line JSON viewer should default to collapsed, not expanded

Summary

When a log line's text parses as a JSON object, the frontend renders it via a collapsible tree view — but every node starts expanded, so a line with a large JSON payload dumps its entire structure into the timeline by default instead of showing a collapsed summary the user opts into expanding.

Where

  • webapp/src/components/LogPreview.tsx:97-107 — JsonValueView recursively renders JSON values, delegating objects/arrays to JsonNode.
  • webapp/src/components/LogPreview.tsx:109-156 — JsonNode renders a collapsible subtree with a ▾/▸ disclosure toggle. Default state is set at line 116: useState(true), i.e. expanded. Each nested object/array has its own independent expanded state.
  • webapp/src/components/LogPreview.tsx:160-164 — LogMessage is the per-row entry point: parses the line via tryParseJsonObject (:82-94) and renders through JsonValueView when it succeeds.
  • Empty objects/arrays already short-circuit to plain {}/[] with no toggle (:118-125) — unaffected by this change.

Scope

  • Flip the default in JsonNode (LogPreview.tsx:116) from useState(true) to useState(false) so JSON subtrees render collapsed until the user clicks to expand.
  • Since expand state is per-node (not shared across the tree), this changes every node in a JSON log line's tree independently — confirm that's the intended look (top-level object collapsed with {...} rather than only nested children collapsing) rather than needing a "expand root, collapse children" split default.