diff --git a/components/file-diff-viewer.tsx b/components/file-diff-viewer.tsx index 99f6673..ba00ce0 100644 --- a/components/file-diff-viewer.tsx +++ b/components/file-diff-viewer.tsx @@ -195,7 +195,9 @@ export function FileDiffViewer({ return null } - file.initTheme(mounted ? theme : 'light') + // Initialize with the current theme + const currentTheme = mounted ? theme : 'light' + file.initTheme(currentTheme) // Wrap file.init() in try-catch to handle diff parsing errors try { @@ -219,6 +221,13 @@ export function FileDiffViewer({ } }, [diffData, mounted, theme, viewMode]) + // Re-initialize theme when it changes + useEffect(() => { + if (diffFile && mounted) { + diffFile.initTheme(theme) + } + }, [diffFile, theme, mounted]) + if (!selectedFile) { // Don't show "No file selected" during initial loading if (isInitialLoading) { @@ -271,7 +280,7 @@ export function FileDiffViewer({ return (
Binary File
This is binary content and cannot be displayed