add timeout to dispatch when clearing queue

This commit is contained in:
jeffvli
2021-09-03 22:46:33 -07:00
parent 2c55f3d5c7
commit b52a92aa14

View File

@@ -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