From cd4844863ece8c767c941fdc543e5dda6e0bff1b Mon Sep 17 00:00:00 2001 From: RaktimaNXG Date: Wed, 26 Jun 2024 17:53:46 +0530 Subject: [PATCH] fix: unnecessary showing message faild to load on send document popup --- .../OpenSign/src/primitives/DotLottieReact.js | 23 +++++-------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/apps/OpenSign/src/primitives/DotLottieReact.js b/apps/OpenSign/src/primitives/DotLottieReact.js index b3b001d00..66ca3b8b3 100644 --- a/apps/OpenSign/src/primitives/DotLottieReact.js +++ b/apps/OpenSign/src/primitives/DotLottieReact.js @@ -2,20 +2,13 @@ import React, { useState, useEffect } from "react"; import { DotLottieReact } from "@lottiefiles/dotlottie-react"; import Loader from "./Loader"; -const LottieWithLoader = ({ - src = "https://lottie.host/00a72a09-f2d4-493a-9b2d-2843bf067638/Ic7jJ44wLJ.json", - minLoaderTime = 1000, - timeout = 10000 -}) => { +const LottieWithLoader = () => { const [isLoaded, setIsLoaded] = useState(false); const [hasError, setHasError] = useState(false); const [animationSrc, setAnimationSrc] = useState(null); - + const src = + "https://lottie.host/00a72a09-f2d4-493a-9b2d-2843bf067638/Ic7jJ44wLJ.json"; useEffect(() => { - const timer = setTimeout(() => { - setHasError(true); - }, timeout); - fetch(src) .then((response) => { if (!response.ok) { @@ -26,17 +19,13 @@ const LottieWithLoader = ({ .then((blob) => { const objectURL = URL.createObjectURL(blob); setAnimationSrc(objectURL); - setTimeout(() => { - setIsLoaded(true); - }, minLoaderTime); + setIsLoaded(true); }) .catch((error) => { - console.error("There was a problem with the fetch operation:", error); + console.error("faild to load animation of send request:", error); setHasError(true); }); - - return () => clearTimeout(timer); - }, [src, minLoaderTime, timeout]); + }, [src]); return (