fix: ErrorBoundary fallback 렌더 시 errorInfo null 크래시 방지

[작업내용] :
- getDerivedStateFromError 가 errorInfo 를 채우지 않아 첫 fallback 렌더에서 this.state.errorInfo 가 null
- componentStack 접근에 옵셔널 체이닝(?.) 추가 — componentDidCatch 의 setState 후 정상 표시
- ErrorBoundary 가 자기 자신을 크래시시켜 원본 에러를 가리던 이중 에러 해소

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jaeyoung Lee 2026-06-15 13:09:56 +09:00
parent fd83fa3aa0
commit 0944aa3a8c

View File

@ -40,7 +40,7 @@ class ErrorBoundary extends React.Component {
<p><strong>Timestamp:</strong> {new Date().toISOString()}</p>
<p><strong>Error:</strong> {this.state.error && this.state.error.toString()}</p>
<p><strong>Stack Trace:</strong></p>
<pre>{this.state.errorInfo.componentStack}</pre>
<pre>{this.state.errorInfo?.componentStack}</pre>
</details>
<button
onClick={() => this.setState({ hasError: false, error: null, errorInfo: null })}