Fix duplicate notifications REQ caused by cursor in query key

This commit is contained in:
Chad Curtis
2026-03-01 02:35:58 -06:00
parent 6eb2672828
commit cceae7fed3
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ export function useHasUnreadNotifications(): boolean {
: null;
const { data: hasUnread = false } = useQuery<boolean>({
queryKey: ['notifications-unread', user?.pubkey ?? '', notificationsCursor],
queryKey: ['notifications-unread', user?.pubkey ?? ''],
queryFn: async ({ signal }) => {
if (!user || notificationsCursor === null) return false;
+1
View File
@@ -215,6 +215,7 @@ export function useNotifications(): NotificationData {
await updateSettings.mutateAsync({
notificationsCursor: newestTimestamp,
});
queryClient.invalidateQueries({ queryKey: ['notifications-unread', user.pubkey] });
} catch (error) {
console.error('Failed to mark notifications as read:', error);
// Roll back optimistic cursor on failure