Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cli/src/components/tools/__tests__/apply-patch.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('ApplyPatchComponent', () => {
expect(markup).toContain('src/new-file.ts')
})

test('renders update_file operation with diff content', () => {
test('renders update_file operation without diff content while diff rendering is disabled', () => {
const toolBlock = createToolBlock({
type: 'update_file',
path: 'src/existing.ts',
Expand All @@ -62,8 +62,8 @@ describe('ApplyPatchComponent', () => {
const markup = renderToStaticMarkup(result?.content as React.ReactElement)
expect(markup).toContain('Edit')
expect(markup).toContain('src/existing.ts')
expect(markup).toContain('-oldLine')
expect(markup).toContain('+newLine')
expect(markup).not.toContain('-oldLine')
expect(markup).not.toContain('+newLine')
})

test('renders delete_file operation', () => {
Expand Down
7 changes: 7 additions & 0 deletions cli/src/components/tools/diff-viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ interface DiffViewerProps {
diffText: string
}

const RENDER_DIFFS = false

const DIFF_LINE_COLORS = {
dark: {
added: '#7ACC35',
Expand Down Expand Up @@ -50,6 +52,11 @@ const lineColor = (

export const DiffViewer = ({ diffText }: DiffViewerProps) => {
const theme = useTheme()

if (!RENDER_DIFFS) {
return null
}

const lines = diffText.trim().split('\n')

return (
Expand Down
Loading