Skip to content

fix(results-grid): parse the trimmed JSON text in the row detail - #1943

Merged
cevheri merged 1 commit into
mainfrom
fix/row-detail-nbsp-json
Oct 24, 2026
Merged

cevheri merged 1 commit into
mainfrom
fix/row-detail-nbsp-json

Conversation

@cevheri

@cevheri cevheri commented Oct 24, 2026

Copy link
Copy Markdown
Member

The row detail threw for a JSON string that starts or ends with a no-break space. classifyValue trims a string before parsing it, and String.prototype.trim removes U+00A0, so "\u00a0{\"a\":1}" classifies as json. jsonRenderer.renderDetail then parsed the untrimmed value, and JSON.parse reads U+00A0 as a token, so the detail failed with JSON Parse error: Unrecognized token.

renderDetail now parses the same trimmed text classifyValue parsed, and the comment that said the parse cannot throw is corrected. A value whose text is not what a re-print would give, such as a 2^53+ integer, still keeps its stored text.

The renderer test was written first and failed on main. An independent check tried 14 whitespace characters at the start, end and both sides of 8 bodies: main threw on 132 of them, this branch on none. No non-JSON value classified as json.

classifyValue trims a string before it parses it, and trim drops U+00A0, which JSON.parse rejects as a token. A cell holding a JSON container behind a non-breaking space was classified as json, and the row detail then parsed the untrimmed text and threw. The detail now parses the same trimmed text, and a lossy value still keeps its stored text.
@codecov

codecov Bot commented Oct 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@sonarqubecloud

Copy link
Copy Markdown

@cevheri
cevheri merged commit 0cfb6fc into main Oct 24, 2026
39 checks passed
@cevheri
cevheri deleted the fix/row-detail-nbsp-json branch October 24, 2026 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant