From 461be4a0a54cac8bc8b6ac94afacd42bef07679e Mon Sep 17 00:00:00 2001 From: haorwen Date: Tue, 30 Jun 2026 10:12:01 +0800 Subject: [PATCH] fix: auto-reset transient React error #185 silently --- src/components/ErrorCatcher.tsx | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/components/ErrorCatcher.tsx b/src/components/ErrorCatcher.tsx index 74232c71..2d27f464 100644 --- a/src/components/ErrorCatcher.tsx +++ b/src/components/ErrorCatcher.tsx @@ -1,4 +1,4 @@ -import { ReactNode } from "react"; +import { ReactNode, useEffect } from "react"; import { ErrorBoundary } from "react-error-boundary"; import StyledButton from "./styled/Button"; @@ -6,7 +6,26 @@ type FallbackProps = { error: Error; resetErrorBoundary: (...args: Array) => void; }; + +// Transient errors that are safe to auto-recover from silently. +// #185 = Maximum update depth exceeded (loop re-render, resolves on reset). +const AUTO_RESET_PATTERNS = [/Minified React error #185/]; + +function isAutoResetError(error: Error): boolean { + return AUTO_RESET_PATTERNS.some((p) => p.test(error.message)); +} + function ErrorFallback({ error, resetErrorBoundary }: FallbackProps) { + useEffect(() => { + if (isAutoResetError(error)) { + resetErrorBoundary(); + } + }, [error, resetErrorBoundary]); + + if (isAutoResetError(error)) { + return null; + } + return (

Something went wrong: