Notifications
How live notifications arrive over the socket, where they are stored, and how the bell and the Notifications page behave.
Notifications in the tenant web app are live-only. They are pushed over the socket while the app is open, saved in the browser's localStorage, and read back from there. The app never fetches a notification history from the API.
Where it lives
| Route | View / component file | Access |
|---|---|---|
/app/notifications | src/views/app/notifications.tsx | signed-in |
| Bell and unread badge | src/components/landing/navbar.tsx | signed-in |
| Socket listener | src/app.tsx | signed-in at app start |
Before you start
- The listener is attached once, when the app starts, and only if an access token is already in
sessionStorageat that moment. - Notifications are per browser. They do not follow the user to another device or browser, and they are not shared with the mobile app's notification list.
Flow
Receiving a notification
- On app start with a stored token, the app connects the shared socket, emits
notifications:subscribeand listens fornotifications:new. - Each event carries
id,type(property,messages,paymentsorsecurity),title,bodyand an optionalcreatedAt. - The app builds a stored item with a time label (for example "Mar 6, 2:15 PM", or "Just now" when there is no valid date) and
read: false. - It writes the item to the front of the
notificationsarray inlocalStorage, replacing any earlier item with the sameid. - It dispatches a browser event,
app:notification:new, which the navbar and the Notifications page listen for.
The bell
- The navbar counts unread items in
localStorageand shows a red badge on the bell, capped at 99+. On phones the menu button shows a red dot instead, and the drawer's Notifications row shows the count. - The count refreshes on
app:notification:newand on the browser'sstorageevent, so another tab's changes are picked up. - Clicking the bell marks every stored notification as read, resets the badge to zero and opens
/app/notifications.
The Notifications page
- The page lists stored notifications, newest first, each with an icon by type, the title, body and time. Unread items are visually highlighted.
- Tabs filter by category: All, Property, Messages, Payments and Security.
- Clicking a notification marks that one as read. It does not navigate anywhere; notifications carry no link.
- When unread items exist the header reads "You have N unread notifications" and a Mark all as read button appears.
- New notifications that arrive while the page is open appear immediately.
Because the bell marks everything as read before opening the page, the unread header and Mark all as read are normally only seen when a notification arrives while the page is already open, or when the page is opened by URL.
States and edge cases
- Empty. A bell icon with "No notifications here", for the whole list or for a tab with no items.
- No loading or error state. The page reads
localStoragesynchronously and makes no request. - Signed out. The page still opens and shows whatever is stored in the browser.
- Unknown type. Any type other than property, messages or payments is filed under Security.
- No delete. Items cannot be removed from the UI, and the list is never trimmed.
Live delivery has gaps
Three things in the code limit when notifications actually arrive. First, the listener is only attached at app start when a token exists, so a user who has just signed in gets no live notifications until the next full page load. Second, the message page and the escrow tracking page disconnect and discard the shared socket when the user leaves them, which silently drops the listener until a reload. Third, anything sent while the app is closed is never fetched later. Treat the in-app list as best-effort; email is the dependable channel.
Stored notifications survive sign-out
Signing out removes the token, refresh token and user from storage but leaves the notifications key in place. The next person to sign in on the same browser sees the previous user's stored notifications.
What happens next
- Reading a notification changes only the local
readflag. Nothing is reported back to the backend. - Which events produce a notification is decided on the backend. The app tour describes the bell as the place where "Booking updates, inspection reminders and payment confirmations land".
- Which channels a user receives (in-app, email) is set under Account and settings, Notifications tab.
HomeLink Hub