mirror of
https://github.com/zoriya/flood.git
synced 2026-05-30 18:10:09 +00:00
FloodActions: do not fetchNotifications after clearNotifications
This avoids race between state changes. Server should be trusted and assumed to have done the job.
This commit is contained in:
@@ -72,14 +72,14 @@ const ServerEventHandlers: Record<keyof ServerEvents, (event: unknown) => void>
|
||||
} as const;
|
||||
|
||||
const FloodActions = {
|
||||
clearNotifications: (options: NotificationFetchOptions) => {
|
||||
clearNotifications: () => {
|
||||
NotificationStore.clearAll();
|
||||
return axios
|
||||
.delete(`${baseURI}api/notifications`)
|
||||
.then((json) => json.data)
|
||||
.then(
|
||||
() => {
|
||||
FloodActions.fetchNotifications(options);
|
||||
// do nothing.
|
||||
},
|
||||
() => {
|
||||
// do nothing.
|
||||
|
||||
@@ -222,11 +222,7 @@ class NotificationsButton extends Component<WrappedComponentProps, Notifications
|
||||
this.tooltipRef.dismissTooltip();
|
||||
}
|
||||
|
||||
FloodActions.clearNotifications({
|
||||
id: 'notification-tooltip',
|
||||
limit: NOTIFICATIONS_PER_PAGE,
|
||||
start: 0,
|
||||
});
|
||||
FloodActions.clearNotifications();
|
||||
};
|
||||
|
||||
handleNotificationCountChange = () => {
|
||||
|
||||
Reference in New Issue
Block a user