Skip to content

Commit

Permalink
fix: Remove all proof request notifications during multiple deletions. (
Browse files Browse the repository at this point in the history
#170)

Signed-off-by: Jean-Christophe Drouin <[email protected]>
  • Loading branch information
jcdrouin21 authored Dec 5, 2024
1 parent 91a12bf commit 8c716f8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions app/src/components/NotificationListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ const NotificationListItem: React.FC<NotificationListItemProps> = ({

const dismissProofRequest = async () => {
if (agent && notificationType === NotificationTypeEnum.ProofRequest) {
markProofAsViewed(agent, notification as ProofExchangeRecord)
await markProofAsViewed(agent, notification as ProofExchangeRecord)
}
}

Expand All @@ -172,8 +172,11 @@ const NotificationListItem: React.FC<NotificationListItemProps> = ({
customNotification?.onCloseAction(dispatch as any)
}

const removeNotification = async () => {
if (notificationType === NotificationTypeEnum.ProofRequest) {
const removeNotification = useCallback(async () => {
if (
notificationType === NotificationTypeEnum.ProofRequest &&
(notification as ProofExchangeRecord).state !== ProofState.Declined
) {
if ((notification as ProofExchangeRecord).state === ProofState.Done) {
await dismissProofRequest()
} else {
Expand All @@ -186,7 +189,7 @@ const NotificationListItem: React.FC<NotificationListItemProps> = ({
} else if (notificationType === NotificationTypeEnum.Custom) {
await declineCustomNotification()
}
}
}, [notificationType, notification])

const detailsForNotificationType = async (notificationType: NotificationTypeEnum): Promise<DisplayDetails> => {
return new Promise((resolve) => {
Expand Down

0 comments on commit 8c716f8

Please sign in to comment.