From b52a92aa1475d6c9b60cc418529a3ff06d47aaaf Mon Sep 17 00:00:00 2001 From: jeffvli Date: Fri, 3 Sep 2021 22:46:33 -0700 Subject: [PATCH] add timeout to dispatch when clearing queue --- src/components/player/NowPlayingView.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/player/NowPlayingView.tsx b/src/components/player/NowPlayingView.tsx index d9edffa..3e52ab1 100644 --- a/src/components/player/NowPlayingView.tsx +++ b/src/components/player/NowPlayingView.tsx @@ -45,7 +45,7 @@ const NowPlayingView = () => { useEffect(() => { if (scrollWithCurrent) { setTimeout(() => { - tableRef.current.table.current?.scrollTop( + tableRef?.current.table.current?.scrollTop( Number(settings.getSync('songListRowHeight')) * playQueue.currentIndex ); }, 100); @@ -124,8 +124,10 @@ const NowPlayingView = () => { size="sm" onClick={() => { dispatch(clearPlayQueue()); - dispatch(resetPlayer()); dispatch(setStatus('PAUSED')); + // Needs a timeout otherwise the seek may still update after the pause due to + // the delay timeout + setTimeout(() => dispatch(resetPlayer()), 200); }} > Clear queue