mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
remove timeout
This commit is contained in:
@@ -6,7 +6,6 @@ import * as Sentry from "@sentry/react";
|
|||||||
const ErrorMessage: React.FC = () => {
|
const ErrorMessage: React.FC = () => {
|
||||||
const { error, setError, humanMessage } = useError();
|
const { error, setError, humanMessage } = useError();
|
||||||
const [isVisible, setIsVisible] = useState<boolean>(false);
|
const [isVisible, setIsVisible] = useState<boolean>(false);
|
||||||
const [timeoutId, setTimeoutId] = useState<NodeJS.Timeout>();
|
|
||||||
|
|
||||||
// Setup Shortcuts
|
// Setup Shortcuts
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -39,27 +38,12 @@ const ErrorMessage: React.FC = () => {
|
|||||||
}
|
}
|
||||||
}, [error]);
|
}, [error]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (isVisible) {
|
|
||||||
setTimeoutId(
|
|
||||||
setTimeout(() => {
|
|
||||||
setIsVisible(false);
|
|
||||||
setTimeoutId(undefined);
|
|
||||||
}, 30000),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (!isVisible && timeoutId) {
|
|
||||||
clearTimeout(timeoutId);
|
|
||||||
}
|
|
||||||
}, [isVisible]);
|
|
||||||
|
|
||||||
if (!isVisible || !humanMessage) return null;
|
if (!isVisible || !humanMessage) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsVisible(false);
|
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"
|
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"
|
role="alert"
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ const useWaveform = (protectedPath, id: string): AudioWaveFormResponse => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!id || !api) return;
|
if (!id || !api) return;
|
||||||
console.log("hee");
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const requestParameters: V1TranscriptGetAudioWaveformRequest = {
|
const requestParameters: V1TranscriptGetAudioWaveformRequest = {
|
||||||
transcriptId: id,
|
transcriptId: id,
|
||||||
@@ -37,6 +36,7 @@ const useWaveform = (protectedPath, id: string): AudioWaveFormResponse => {
|
|||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
setErrorState(err);
|
setErrorState(err);
|
||||||
|
console.log(err);
|
||||||
const shouldShowHuman = shouldShowError(err);
|
const shouldShowHuman = shouldShowError(err);
|
||||||
if (shouldShowHuman) {
|
if (shouldShowHuman) {
|
||||||
setError(err, "There was an error loading the waveform");
|
setError(err, "There was an error loading the waveform");
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
function shouldShowError(error: Error | null | undefined) {
|
function shouldShowError(error: Error | null | undefined) {
|
||||||
if (error?.name == "ResponseError" && error["response"].status == 404)
|
if (error?.name == "ResponseError" && error["response"].status == 404)
|
||||||
return false;
|
return false;
|
||||||
|
if (error?.name == "FetchError") return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user