-
Notifications
You must be signed in to change notification settings - Fork 23
feat: add clear notification history feature #239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: api-v2
Are you sure you want to change the base?
feat: add clear notification history feature #239
Conversation
@ChiefWoods is attempting to deploy a commit to the dialect Team on Vercel. A member of the Team first needs to authorize it. |
const sdk = useDialectSdk(); | ||
|
||
const { trigger, isMutating, error } = useSWRMutation( | ||
appId && clientKey ? CACHE_KEY_READ_MUTATION(appId) : null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please create a separate key for history clear mutation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed that, added a new fix commit
@ChiefWoods thanks for the PR! Haven't checked the UI/UX changes yet, but the code looks good |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds a "clear notification history" feature that allows users to remove all notifications from their current app, keeping their notification list clean. The feature is accessible through a trash icon button in the notifications header.
- Implements
useClearHistory
hook to handle API calls for clearing notification history - Adds a clear notifications button to the header component with trash icon
- Integrates clear functionality with history refresh to update the UI after clearing
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
packages/react-sdk/src/hooks/useClearHistory.ts | New hook for clearing notification history via API |
packages/react-sdk/src/hooks/index.ts | Exports the new useClearHistory hook |
packages/react-ui/src/ui/core/Header.tsx | Adds clear notifications button with trash icon |
packages/react-ui/src/ui/notifications/NotificationsFeed/NotificationsFeedHeader.tsx | Integrates clear functionality with header |
packages/react-ui/src/ui/notifications/NotificationsFeed/NotificationsFeed.tsx | Adds clear error handling to feed container |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
throw await response.json(); | ||
} | ||
|
||
return response.json() as Promise<void>; |
Copilot
AI
Sep 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return type casting is incorrect. response.json()
returns Promise<any>
, but you're casting it as Promise<void>
. Since the API likely returns some response data, either remove the type assertion or change it to Promise<any>
or the actual expected response type.
return response.json() as Promise<void>; | |
return response.json(); |
Copilot uses AI. Check for mistakes.
onSettingsClick={() => setRoute(Route.Settings)} | ||
onCloseClick={() => setOpen?.(false)} | ||
onClearNotificationsClick={() => { | ||
clear().then(() => refresh()); |
Copilot
AI
Sep 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing error handling for the clear operation. If clear()
fails, the promise chain will be rejected but there's no catch handler to prevent unhandled promise rejection.
clear().then(() => refresh()); | |
clear() | |
.then(() => refresh()) | |
.catch((err) => { | |
console.error('Failed to clear notifications:', err); | |
}); |
Copilot uses AI. Check for mistakes.
Notifications that are read remain on the list. Some users may wish to keep their lists clean. The addition of a 'clear notification' button now allows users to wipe their history for the current app.
Notes: