Skip to content

Commit

Permalink
fix: add trackComplete to useEffect dependency array
Browse files Browse the repository at this point in the history
the use effect needs updated dependencies to work as intended. The
trackComplete function is not a direct depenency, but it stores all of
the referenced dependencies.
  • Loading branch information
thearyadev committed Jan 18, 2025
1 parent 5a7a6a4 commit ee65119
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/app/providers/queue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const QueueProvider: React.FC<{
// biome-ignore lint/correctness/useExhaustiveDependencies : wrong
const trackComplete = useCallback(_trackComplete, [autoplay, loop, track])

// biome-ignore lint/correctness/useExhaustiveDependencies : causes infinite loop
// biome-ignore lint/correctness/useExhaustiveDependencies : i disagree
useEffect(() => {
navigator.mediaSession.setActionHandler('nexttrack', () => {
nextTrack()
Expand All @@ -104,7 +104,8 @@ const QueueProvider: React.FC<{
navigator.mediaSession.setActionHandler('nexttrack', null)
navigator.mediaSession.setActionHandler('previoustrack', null)
}
}, [])

}, [trackComplete])

return (
<QueueContext.Provider
Expand Down

0 comments on commit ee65119

Please sign in to comment.