From 6d31498e6a208be31df6a9ae9965c44c577f9301 Mon Sep 17 00:00:00 2001 From: thzxx Date: Sun, 12 Jul 2026 14:35:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E7=A9=BA=E9=97=B4=E8=AE=BE=E7=BD=AE=E7=99=BD=E5=B1=8F=20?= =?UTF-8?q?=E2=80=94=20DialogActions=20=E6=9C=AA=E5=AF=BC=E5=85=A5=20+=20?= =?UTF-8?q?=E5=8A=A0=20ErrorBoundary?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因:WorkspaceSettings 的重启确认 Dialog 内使用了 DialogActions,但未在 import 中声明,运行时为 undefined,React.createElement(undefined) 抛错导致整个应用白屏 修复:1) 补充 DialogActions 导入;2) 给每个设置 Tab 包 ErrorBoundary,避免单 tab 渲染失败导致整体白屏 --- src/components/settings/SettingsModal.tsx | 35 +++++++++++++++++------ 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/src/components/settings/SettingsModal.tsx b/src/components/settings/SettingsModal.tsx index 86a12c2..462f5ec 100644 --- a/src/components/settings/SettingsModal.tsx +++ b/src/components/settings/SettingsModal.tsx @@ -3,12 +3,13 @@ */ import { useState, useEffect, useCallback } from 'react'; -import { Dialog, DialogContent, DialogTitle, Button, TextField, Select, MenuItem, Tabs, Tab, Checkbox, Box, Typography, Stack, Divider, FormControlLabel, InputLabel, FormControl, IconButton, Chip, Switch, Alert, CircularProgress } from '@mui/material'; +import { Dialog, DialogContent, DialogTitle, DialogActions, Button, TextField, Select, MenuItem, Tabs, Tab, Checkbox, Box, Typography, Stack, Divider, FormControlLabel, InputLabel, FormControl, IconButton, Chip, Switch, Alert, CircularProgress } from '@mui/material'; import { alpha } from '@mui/material/styles'; import { X, Settings, Bot, Wrench, Server, Palette, FileText, Eye, EyeOff, FolderOpen, Globe } from 'lucide-react'; import { useUIStore, type ThemeMode } from '@renderer/stores/ui-store'; import { useAgentStore } from '@renderer/stores/agent-store'; import { PROVIDER_LABELS } from '@renderer/lib/constants'; +import { ErrorBoundary } from '@renderer/components/common/ErrorBoundary'; type SettingsTab = 'workspace' | 'llm' | 'agent' | 'tools' | 'mcp' | 'searxng' | 'appearance' | 'logs'; const TABS: { id: SettingsTab; label: string; icon: typeof Settings }[] = [ @@ -48,14 +49,30 @@ export function SettingsModal(): React.JSX.Element | null { {TABS.map((t) => } iconPosition="start" />)} - {tab === 'workspace' && } - {tab === 'llm' && } - {tab === 'agent' && } - {tab === 'tools' && } - {tab === 'mcp' && } - {tab === 'searxng' && } - {tab === 'appearance' && } - {tab === 'logs' && } + + {tab === 'workspace' && } + + + {tab === 'llm' && } + + + {tab === 'agent' && } + + + {tab === 'tools' && } + + + {tab === 'mcp' && } + + + {tab === 'searxng' && } + + + {tab === 'appearance' && } + + + {tab === 'logs' && } +