Fix duplicate notifications REQ caused by cursor in query key
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user