Add real-time updates for meeting alerts across user devices
Introduce real-time event listeners and emitters to synchronize meeting alert status changes, such as "Done" or "Dismissed", across a user's multiple open tabs and devices. This update refactors the `executive-meetings.ts` route to trigger a per-user socket event upon state transitions, which is then handled by `use-notifications-socket.ts` to invalidate the alert state query, ensuring near-instantaneous UI updates. New tests in `executive-meetings-upcoming-alert.spec.mjs` verify the cross-tab synchronization for both "Done" and "Dismiss" actions, confirming that only the acting user's alerts are affected. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 77cfe984-2c65-4152-bb7a-0df28274fe66 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: b81561d1-3ba4-46fc-96c0-77d50130c061 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/c3c252e4-c83d-40ca-9fff-99a3ea60701e/77cfe984-2c65-4152-bb7a-0df28274fe66/8gwn7Xm Replit-Helium-Checkpoint-Created: true
This commit is contained in:
@@ -92,6 +92,21 @@ export function useNotificationsSocket() {
|
||||
});
|
||||
});
|
||||
|
||||
// #277: Per-user push for the 5-min upcoming-meeting alert. The server
|
||||
// only emits this to `user:${userId}`, so receiving it means *this*
|
||||
// user (in this or another of their tabs / devices) acknowledged or
|
||||
// dismissed an alert. Invalidate the alert-state query so the open
|
||||
// alert card hides within ~1s instead of waiting on the 30s poll.
|
||||
// Other users do not receive this event, so their alert stays visible.
|
||||
socket.on(
|
||||
"executive_meeting_alert_state_changed",
|
||||
() => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ["/api/executive-meetings/alert-state"],
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
socket.on(
|
||||
"role_permissions_changed",
|
||||
(payload?: { roleId?: number }) => {
|
||||
|
||||
Reference in New Issue
Block a user