Please provide more details.
I think the sidebarContent is a ref from useRef. The ref shouldn't be used as deps of useEffect. I will always be the same reference and the react won't rerender. Please try to use useState
sidebarContent
useRef
useEffect
useState