Skip to content

Commit 186cb52

Browse files
committed
fix: hide Test ErrorBoundary button in production mode
- Added NODE_ENV environment variable to vite config - Conditionally render the Test ErrorBoundary button only in development mode - This prevents users from accidentally triggering test errors in production Fixes #6215
1 parent d62a260 commit 186cb52

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,12 @@ export const About = ({ telemetrySetting, setTelemetrySetting, className, ...pro
110110
</Button>
111111

112112
{/* 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>
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+
)}
117119
</div>
118120
</Section>
119121
</div>

webview-ui/vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ 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),
6263
"process.env.VSCODE_TEXTMATE_DEBUG": JSON.stringify(process.env.VSCODE_TEXTMATE_DEBUG),
6364
"process.env.PKG_NAME": JSON.stringify(pkg.name),
6465
"process.env.PKG_VERSION": JSON.stringify(pkg.version),

0 commit comments

Comments
 (0)