From 3dbcf3d5c0bb77060b6f5d5e9ef32df836cfe660 Mon Sep 17 00:00:00 2001 From: Chris-1010 <122332721@umail.ucc.ie> Date: Fri, 28 Feb 2025 23:11:49 +0000 Subject: [PATCH] UPDATE/FIX: Enforce `Sidebar` uniqueness by giving it a random ID --- frontend/src/components/Navigation/Sidebar.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/Navigation/Sidebar.tsx b/frontend/src/components/Navigation/Sidebar.tsx index b8fd535..6cb5e8f 100644 --- a/frontend/src/components/Navigation/Sidebar.tsx +++ b/frontend/src/components/Navigation/Sidebar.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from "react"; +import React, { useEffect, useState, useRef } from "react"; import { SidebarIcon } from "lucide-react"; import { useNavigate } from "react-router-dom"; import { useAuth } from "../../context/AuthContext"; @@ -26,6 +26,7 @@ const Sidebar: React.FC = ({ extraClasses = "" }) => { const [followedStreamers, setFollowedStreamers] = useState([]); const [followedCategories, setFollowedCategories] = useState([]); const [justToggled, setJustToggled] = useState(false); + const sidebarId = useRef(Math.floor(Math.random() * 1000000)); // Fetch followed streamers useEffect(() => { @@ -107,7 +108,7 @@ const Sidebar: React.FC = ({ extraClasses = "" }) => { )}