fix(files): address review feedback on navigation and path fallback

Key initial directory navigation to the initial selection so viewport changes do not reset it, and open the mobile preview from a separate effect.

Fall back to the legacy filePath input when path is empty, and cover both with regression tests.
This commit is contained in:
Chris Scott committed 2026-09-28 22:25:45 -04:00
1 parent cd7d139a31
commit 12eba5097c
4 files changed
+75 -7

No files matched your search

@@ -406,6 +406,25 @@ describe('MessagePart', () => {
expect(screen.getByText('+1')).toBeInTheDocument()
})
it('falls back to filePath when path is empty', () => {
const onFileClick = vi.fn()
renderWithProviders(
<MessagePart
part={toolPart('read', {
status: 'completed',
input: { path: '', filePath: '/test/fallback.html' },
content: [{ type: 'text', text: 'ok' }],
metadata: {},
})}
onFileClick={onFileClick}
/>,
)
fireEvent.click(screen.getByText('/test/fallback.html'))
expect(onFileClick).toHaveBeenCalledWith('/test/fallback.html')
})
it('renders every file of a multi-file patch with per-file links', () => {
const onFileClick = vi.fn()
renderWithProviders(