diff --git a/components/ui/SpotifyPlayer.tsx b/components/ui/SpotifyPlayer.tsx index 9eb22c4..e8af874 100644 --- a/components/ui/SpotifyPlayer.tsx +++ b/components/ui/SpotifyPlayer.tsx @@ -110,7 +110,13 @@ type PlayerStateResponse = { } function usePlayerState(path: string) { - const {data, error, isLoading} = useSWR(`/api/spotify/${path}`, fetcher) as PlayerStateResponse + const {data, error, isLoading} = useSWR(`/api/spotify/${path}`, fetcher, { + refreshInterval: 3600, + revalidateIfStale: true, + revalidateOnMount: true, + revalidateOnFocus: true, + revalidateOnReconnect true + }) as PlayerStateResponse return { song: data, @@ -188,8 +194,6 @@ Song.Skeleton = function SongSkeleton() { ) } -export const revalidate = 0 - export function SpotifyPlayer(): ReactElement | null { const currentlyPlaying = usePlayerState('currently-playing') const lastPlayed = usePlayerState('last-played')