-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Description:
When a user accepts or declines a friend request from the notifications dropdown, the notification is immediately removed from the UI (using local state). However, if the user reloads the page before the backend has finished updating, the friend request notification reappears in the dropdown. This is because the local dismissed state is lost on reload, and the notification is still present in the backend data.
To Reproduce:
- Receive a friend request (notification appears in dropdown).
- Click "Accept" or "Decline"—the notification disappears as expected.
- Immediately reload the page.
- The friend request notification reappears in the dropdown until the backend update is complete.
Expected behavior
Once a friend request is accepted or declined, the notification should not reappear, even after a page reload.
Possible solutions
- Ensure the backend removes the friend request notification immediately after the action.
- In the frontend, filter out friend request notifications if the sender is already in the user's friends list or the request is no longer pending.
- Consider persisting dismissed notification IDs in localStorage/sessionStorage until the backend reflects the change.
Relevant code
See src/components/NotificationsDropdown.tsx for the current implementation.
Additional context
This is a UX issue that can cause confusion for users, as it appears that the friend request was not handled successfully.