try to do better
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import React, { Component, ReactNode } from 'react';
|
||||
import React, { Component } from 'react';
|
||||
import type { ReactNode } from 'react';
|
||||
import { AlertTriangle } from 'lucide-react';
|
||||
import { Button } from './ui';
|
||||
|
||||
@@ -22,7 +23,7 @@ export class ErrorBoundary extends Component<Props, State> {
|
||||
};
|
||||
}
|
||||
|
||||
static getDerivedStateFromError(error: Error): Partial<State> {
|
||||
static getDerivedStateFromError(_error: Error): Partial<State> {
|
||||
return { hasError: true };
|
||||
}
|
||||
|
||||
@@ -57,7 +58,7 @@ export class ErrorBoundary extends Component<Props, State> {
|
||||
<p className="text-gray-600 dark:text-gray-400 mb-6">
|
||||
We're sorry, but something unexpected happened. Please try refreshing the page or going back to the home page.
|
||||
</p>
|
||||
{process.env.NODE_ENV === 'development' && this.state.error && (
|
||||
{import.meta.env.DEV && this.state.error && (
|
||||
<div className="mb-6 p-4 bg-red-50 dark:bg-red-900/10 rounded-lg text-left">
|
||||
<p className="text-sm font-mono text-red-800 dark:text-red-300 break-all">
|
||||
{this.state.error.toString()}
|
||||
|
||||
Reference in New Issue
Block a user