From e40ea258dcb6d775125c1525197c2a10408cce1b Mon Sep 17 00:00:00 2001 From: Bruno Quaresma Date: Fri, 21 Mar 2025 14:12:22 -0300 Subject: [PATCH] fix: fix double ws connection for notifications (#17044) **Issue:** The UI was creating two web socket connections to receive notification updates causing duplicated values. **Cause:** We were rendering the notification container twice. One for the desktop nav and another for mobile. **Fix:** Only use one notification container for the nav. **Improvements for later:** I think would be better at some point to move the networking and data logic into a provider but it would require testing and some tiny rework. Since the actual fix works well, and it is not complex or difficult, I think it is ok to stay with it until we require to load notifications in more places. --- .../modules/dashboard/Navbar/NavbarView.tsx | 64 +++++++++---------- 1 file changed, 30 insertions(+), 34 deletions(-) diff --git a/site/src/modules/dashboard/Navbar/NavbarView.tsx b/site/src/modules/dashboard/Navbar/NavbarView.tsx index 40f9b0ad3a..204828c2fd 100644 --- a/site/src/modules/dashboard/Navbar/NavbarView.tsx +++ b/site/src/modules/dashboard/Navbar/NavbarView.tsx @@ -55,17 +55,21 @@ export const NavbarView: FC = ({ -
+
{proxyContextValue && ( - +
+ +
)} - +
+ +
= ({ /> {user && ( - + +
+ )} + +
+ - )} -
- -
- - API.updateInboxNotificationReadStatus(notificationId, { - is_read: true, - }) - } - /> - - +
);