remove timeout

This commit is contained in:
Sara
2023-11-08 16:24:09 +01:00
parent 92b728363e
commit 68ee6a20a4
3 changed files with 2 additions and 17 deletions

View File

@@ -6,7 +6,6 @@ import * as Sentry from "@sentry/react";
const ErrorMessage: React.FC = () => {
const { error, setError, humanMessage } = useError();
const [isVisible, setIsVisible] = useState<boolean>(false);
const [timeoutId, setTimeoutId] = useState<NodeJS.Timeout>();
// Setup Shortcuts
useEffect(() => {
@@ -39,27 +38,12 @@ const ErrorMessage: React.FC = () => {
}
}, [error]);
useEffect(() => {
if (isVisible) {
setTimeoutId(
setTimeout(() => {
setIsVisible(false);
setTimeoutId(undefined);
}, 30000),
);
}
if (!isVisible && timeoutId) {
clearTimeout(timeoutId);
}
}, [isVisible]);
if (!isVisible || !humanMessage) return null;
return (
<button
onClick={() => {
setIsVisible(false);
setIsVisible(false);
}}
className="max-w-xs z-50 fixed bottom-5 right-5 md:bottom-10 md:right-10 border-solid bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded transition-opacity duration-300 ease-out opacity-100 hover:opacity-80 focus-visible:opacity-80 cursor-pointer transform hover:scale-105 focus-visible:scale-105"
role="alert"