fix: recalculate notification dropdown position after content loads
The dropdown position was only clamped on initial render when the panel was empty. After async notifications loaded and the panel grew taller, the position was never recalculated. Add an effect that re-clamps when notifications or loading state changes.
This commit is contained in:
@@ -104,6 +104,13 @@ export default function NotificationCenter({ anchor = 'bottom', variant = 'defau
|
||||
}
|
||||
}, [open, updatePosition])
|
||||
|
||||
// Recalculate position after content changes (notifications load, loading state)
|
||||
useEffect(() => {
|
||||
if (open && anchor === 'right') {
|
||||
requestAnimationFrame(() => updatePosition())
|
||||
}
|
||||
}, [notifications, loading, open, anchor, updatePosition])
|
||||
|
||||
// * Poll unread count in background (when authenticated)
|
||||
useEffect(() => {
|
||||
fetchUnreadCount()
|
||||
|
||||
Reference in New Issue
Block a user