From f06c0a5cfac7ef7fc7660b5bc8daf9eef1f9a5b5 Mon Sep 17 00:00:00 2001 From: Shahidul Alam Riyad Date: Wed, 15 May 2024 15:22:19 +0600 Subject: [PATCH] feat: enforce reload if src changed --- src/components/AudioPlayer.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/AudioPlayer.tsx b/src/components/AudioPlayer.tsx index e4082cf..b83ca82 100644 --- a/src/components/AudioPlayer.tsx +++ b/src/components/AudioPlayer.tsx @@ -59,6 +59,11 @@ export const AudioPlayer: React.FC = ({ const [coefficient, setCoefficient] = useState(0); const [hasError, setHasError] = useState(false); + useEffect(() => { + handleReload(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [src]); + useEffect(() => { if (!isNaN(volume)) { const tempVol = volume > 100 ? 100 : volume < 0 ? 0 : volume;