Skip to content

Commit a0402df

Browse files
committed
fix: remove Test ErrorBoundary button completely and revert vite config changes
- Removed Test ErrorBoundary button and all related code from About.tsx - Reverted NODE_ENV changes in vite.config.ts as requested by @daniel-lxs
1 parent 186cb52 commit a0402df

File tree

2 files changed

+1
-34
lines changed

2 files changed

+1
-34
lines changed

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

Lines changed: 1 addition & 33 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,14 +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-
{process.env.NODE_ENV === "development" && (
114-
<Button variant="destructive" onClick={triggerTestError} className="w-auto">
115-
<TriangleAlert className="p-0.5" />
116-
Test ErrorBoundary
117-
</Button>
118-
)}
11987
</div>
12088
</Section>
12189
</div>

webview-ui/vite.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ export default defineConfig(({ mode }) => {
5959

6060
const define: Record<string, any> = {
6161
"process.platform": JSON.stringify(process.platform),
62-
"process.env.NODE_ENV": JSON.stringify(mode),
6362
"process.env.VSCODE_TEXTMATE_DEBUG": JSON.stringify(process.env.VSCODE_TEXTMATE_DEBUG),
6463
"process.env.PKG_NAME": JSON.stringify(pkg.name),
6564
"process.env.PKG_VERSION": JSON.stringify(pkg.version),

0 commit comments

Comments
 (0)