Index: frontend/src/components/Sidebar.tsx
===================================================================
--- frontend/src/components/Sidebar.tsx	(revision b071fb4a2344e233ee12641fe437797ae1bbb736)
+++ frontend/src/components/Sidebar.tsx	(revision 5938bc91ed6ba103319368a469dca23bdb676da9)
@@ -1,7 +1,9 @@
 import { useEffect, useState } from "react";
 import axiosInstance from "../api/axiosInstance";
+import { useAuth } from "../context/authContext";
 import type { BasicPlaylist, BasicSong, SidebarProps } from "../utils/types";
 
 const Sidebar = ({ isOpen, onClose }: SidebarProps) => {
+	const { user } = useAuth();
 	const [recentlyListened, setRecentlyListened] = useState<BasicSong[]>([]);
 	const [playlists, setPlaylists] = useState<BasicPlaylist[]>([]);
@@ -25,6 +27,11 @@
 			}
 		};
-		fetchData();
-	}, []);
+		if (user) {
+			fetchData();
+		} else {
+			setRecentlyListened([]);
+			setPlaylists([]);
+		}
+	}, [user]);
 	return (
 		<div
