Skip to content

Commit 1f3a107

Browse files
fix: hide Test ErrorBoundary button in production mode (#6216)
Co-authored-by: Roo Code <[email protected]>
1 parent 878b0bd commit 1f3a107

File tree

1 file changed

+1
-31
lines changed

1 file changed

+1
-31
lines changed

webview-ui/src/components/settings/About.tsx

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { HTMLAttributes, useState } from "react"
1+
import { HTMLAttributes } from "react"
22
import { useAppTranslation } from "@/i18n/TranslationContext"
33
import { Trans } from "react-i18next"
44
import { Info, Download, Upload, TriangleAlert } from "lucide-react"
@@ -22,33 +22,9 @@ type AboutProps = HTMLAttributes<HTMLDivElement> & {
2222

2323
export const About = ({ telemetrySetting, setTelemetrySetting, className, ...props }: AboutProps) => {
2424
const { t } = useAppTranslation()
25-
const [shouldThrowError, setShouldThrowError] = useState(false)
26-
27-
// Function to trigger error for testing ErrorBoundary
28-
const triggerTestError = () => {
29-
setShouldThrowError(true)
30-
}
31-
32-
// Named function to make it easier to identify in stack traces
33-
function throwTestError() {
34-
// Intentionally cause a type error by accessing a property on undefined
35-
const obj: any = undefined
36-
obj.nonExistentMethod()
37-
}
38-
39-
// Test component that throws an error when shouldThrow is true
40-
const ErrorThrower = ({ shouldThrow = false }) => {
41-
if (shouldThrow) {
42-
// Use a named function to make it easier to identify in stack traces
43-
throwTestError()
44-
}
45-
return null
46-
}
4725

4826
return (
4927
<div className={cn("flex flex-col gap-2", className)} {...props}>
50-
{/* Test component that throws an error when shouldThrow is true */}
51-
<ErrorThrower shouldThrow={shouldThrowError} />
5228
<SectionHeader
5329
description={
5430
Package.sha
@@ -108,12 +84,6 @@ export const About = ({ telemetrySetting, setTelemetrySetting, className, ...pro
10884
<TriangleAlert className="p-0.5" />
10985
{t("settings:footer.settings.reset")}
11086
</Button>
111-
112-
{/* Test button for ErrorBoundary - only visible in development */}
113-
<Button variant="destructive" onClick={triggerTestError} className="w-auto">
114-
<TriangleAlert className="p-0.5" />
115-
Test ErrorBoundary
116-
</Button>
11787
</div>
11888
</Section>
11989
</div>

0 commit comments

Comments
 (0)