fix(client): address trajectory review findings

This commit is contained in:
_Kerman
2026-07-28 15:07:44 +08:00
parent 64b9535c31
commit 9096dbb29d
9 changed files with 244 additions and 60 deletions

View File

@@ -289,6 +289,7 @@ function JsonTreeNode({
/>
<NodeField field={field} expandable onToggle={toggle} />
<span className={css.preview}>{previewValue(value, 0)}</span>
{!lastElement && <span className={css.punctuation}>,</span>}
{expanded && (
<ul id={contentsId} role="group" className={css.children}>
{entries.map(([key, item], index) => (
@@ -524,7 +525,7 @@ export function JsonTree({
field={key}
value={value}
path={[Array.isArray(data) ? index : key]}
lastElement
lastElement={index === rootEntries.length - 1}
initialExpanded={false}
tabStopId={tabStopId}
onClaimTabStop={setTabStopId}

View File

@@ -34,7 +34,7 @@ describe('JsonTree', () => {
const tree = screen.getByRole('tree', { name: 'Payload' })
const rows = within(tree).getAllByRole('treeitem')
expect(rows).toHaveLength(2)
expect(rows[0]?.textContent).toBe('nested:{answer: 42}')
expect(rows[0]?.textContent).toBe('nested:{answer: 42},')
expect(rows[1]?.textContent).toBe('list:["alpha", "beta"]')
const expanders = within(tree).getAllByRole('button', { name: 'Expand JSON node' })