fix(ErrorBoundary): Fixing console errors and Improving error logging for better developer experience (#5378)

This commit is contained in:
Vinícius Alves de Faria Resende 2025-09-10 13:40:09 -03:00 committed by GitHub
parent f6d05bc21c
commit 56c5828b02
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View File

@ -39,13 +39,13 @@ export interface ButtonProps
}
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, forwardRef) => {
({ className, variant, size, asChild = false, dataCY, ...props }, forwardRef) => {
const Comp = asChild ? Slot : 'button';
const dataCY = props.dataCY || `${props.name}-btn`;
const testId = dataCY || `${props.name}-btn`;
return (
<Comp
data-cy={dataCY}
data-cy={testId}
className={cn(buttonVariants({ variant, size }), className)}
ref={forwardRef}
{...props}

View File

@ -1,7 +1,7 @@
import React, { useState, useEffect } from 'react';
import { ErrorBoundary as ReactErrorBoundary, FallbackProps } from 'react-error-boundary';
import { useTranslation } from 'react-i18next';
import { Dialog, DialogContent } from '../Dialog/Dialog';
import { Dialog, DialogContent, DialogTitle } from '../Dialog/Dialog';
import { ScrollArea } from '../ScrollArea/ScrollArea';
import { Button } from '../Button/Button';
import { useNotification } from '../../contextProviders';
@ -181,6 +181,7 @@ const DefaultFallback = ({
open={showDetails}
onOpenChange={setShowDetails}
>
<DialogTitle className="invisible">{errorTitle}</DialogTitle>
<DialogContent
className="bg-muted max-w-3xl overflow-hidden border-0 p-0"
onInteractOutside={e => e.preventDefault()}
@ -262,7 +263,6 @@ const ErrorBoundary = ({
let errorTimeout: NodeJS.Timeout;
const handleError = (event: ErrorEvent) => {
event.preventDefault();
clearTimeout(errorTimeout);
errorTimeout = setTimeout(() => {
setError(event.error);