chore: trim excessive comments

This commit is contained in:
wonfen
2026-08-19 07:27:43 +08:00
parent 42b91b6294
commit 807f9a206d
103 changed files with 293 additions and 2517 deletions
@@ -20,10 +20,6 @@ interface State {
showDetails: boolean
}
/**
* 流量统计专用错误边界组件
* 处理图表和流量统计组件的错误,提供优雅的降级体验
*/
export class TrafficErrorBoundary extends Component<Props, State> {
private retryCount = 0
private maxRetries = 3
@@ -39,7 +35,6 @@ export class TrafficErrorBoundary extends Component<Props, State> {
}
static getDerivedStateFromError(error: Error): Partial<State> {
// 更新状态以显示降级UI
return { hasError: true, error }
}
@@ -51,17 +46,14 @@ export class TrafficErrorBoundary extends Component<Props, State> {
errorInfo,
})
// 调用错误回调
if (this.props.onError) {
this.props.onError(error, errorInfo)
}
// 发送错误到监控系统(如果有的话)
this.reportError(error, errorInfo)
}
private reportError = (error: Error, errorInfo: ErrorInfo) => {
// 这里可以集成错误监控服务
const errorReport = {
message: error.message,
stack: error.stack,
@@ -72,8 +64,6 @@ export class TrafficErrorBoundary extends Component<Props, State> {
}
console.error('[TrafficErrorBoundary] 错误报告:', errorReport)
// TODO: 发送到错误监控服务
// sendErrorReport(errorReport);
}
private handleRetry = () => {
@@ -104,12 +94,10 @@ export class TrafficErrorBoundary extends Component<Props, State> {
render() {
if (this.state.hasError) {
// 如果提供了自定义降级组件,使用它
if (this.props.fallbackComponent) {
return this.props.fallbackComponent
}
// 默认错误UI
return (
<TrafficErrorFallback
error={this.state.error}
@@ -129,9 +117,6 @@ export class TrafficErrorBoundary extends Component<Props, State> {
}
}
/**
* 错误降级UI组件
*/
interface TrafficErrorFallbackProps {
error: Error | null
errorInfo: ErrorInfo | null
@@ -283,10 +268,6 @@ const TrafficErrorFallback: React.FC<TrafficErrorFallbackProps> = ({
)
}
/**
* 轻量级流量统计错误边界
* 用于小型流量显示组件,提供最小化的错误UI
*/
export const LightweightTrafficErrorBoundary: React.FC<{
children: ReactNode
}> = ({ children }) => {