fix(#768): remove componentDidUpdate auto-reset to avoid premature reset on Suspense fallback

This commit is contained in:
Sameer6305
2026-07-24 16:15:34 +05:30
parent d2d38a0509
commit adb46134c4
+1 -9
View File
@@ -25,15 +25,7 @@ export class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundarySt
console.error("ErrorBoundary caught an error:", error, errorInfo);
}
componentDidUpdate(_prevProps: ErrorBoundaryProps, prevState: ErrorBoundaryState) {
// If the component has successfully rendered (hasError is false)
// and we were previously tracking retries, reset the retry counter.
// By checking prevState.hasError, we ensure this reset only triggers
// exactly once upon the recovery transition.
if (prevState.hasError && !this.state.hasError && this.state.retryCount > 0) {
this.setState({ retryCount: 0 });
}
}
resetErrorBoundary = () => {
this.setState((prev) => ({