mirror of
https://github.com/LHY0125/PathEditor.git
synced 2026-06-29 09:55:56 +08:00
refactor: 抽取 Modal 组件、支持 JSON/CSV 导出、清理冗余代码
- 新增 Modal 组件,消除 3 个 Dialog 中重复的遮罩层/Escape/stopPropagation 代码 - PathEditDialog/HelpDialog/ImportDialog 改用 Modal 包裹 - handleExport 支持 JSON/CSV 两种格式(CSV 导出代码之前存在但从未接线) - App.tsx 移除冗余的 initDarkMode 后重复设 store 的逻辑 - ErrorBoundary 添加 componentDidCatch 日志和 console.error Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -7,9 +7,14 @@ export class ErrorBoundary extends Component<Props, State> {
|
||||
state: State = { hasError: false, error: '' };
|
||||
|
||||
static getDerivedStateFromError(e: Error): State {
|
||||
console.error('[ErrorBoundary]', e);
|
||||
return { hasError: true, error: e.message };
|
||||
}
|
||||
|
||||
componentDidCatch(_e: Error, info: React.ErrorInfo) {
|
||||
console.error('[ErrorBoundary] componentStack:', info.componentStack);
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.state.hasError) {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user