diff --git a/components/notifications/NotificationCenter.tsx b/components/notifications/NotificationCenter.tsx
index 5f66a37..5837543 100644
--- a/components/notifications/NotificationCenter.tsx
+++ b/components/notifications/NotificationCenter.tsx
@@ -52,6 +52,8 @@ function getTypeIcon(type: string) {
return
}
+const LOADING_DELAY_MS = 250
+
export default function NotificationCenter() {
const [open, setOpen] = useState(false)
const [notifications, setNotifications] = useState([])
@@ -61,8 +63,8 @@ export default function NotificationCenter() {
const dropdownRef = useRef(null)
const fetchNotifications = async () => {
- setLoading(true)
setError(null)
+ const loadingTimer = setTimeout(() => setLoading(true), LOADING_DELAY_MS)
try {
const res = await listNotifications()
setNotifications(Array.isArray(res?.notifications) ? res.notifications : [])
@@ -72,6 +74,7 @@ export default function NotificationCenter() {
setNotifications([])
setUnreadCount(0)
} finally {
+ clearTimeout(loadingTimer)
setLoading(false)
}
}