From 00504393f6dc3463dc88a4fe467dc6647bd4674a Mon Sep 17 00:00:00 2001 From: Jesse Chan Date: Tue, 10 Nov 2020 19:37:49 +0800 Subject: [PATCH] FloodActions: do not fetchNotifications after clearNotifications This avoids race between state changes. Server should be trusted and assumed to have done the job. --- client/src/javascript/actions/FloodActions.ts | 4 ++-- .../javascript/components/sidebar/NotificationsButton.tsx | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/client/src/javascript/actions/FloodActions.ts b/client/src/javascript/actions/FloodActions.ts index b8fa54f8..fa437698 100644 --- a/client/src/javascript/actions/FloodActions.ts +++ b/client/src/javascript/actions/FloodActions.ts @@ -72,14 +72,14 @@ const ServerEventHandlers: Record 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. diff --git a/client/src/javascript/components/sidebar/NotificationsButton.tsx b/client/src/javascript/components/sidebar/NotificationsButton.tsx index 0abe26c5..07fc3acf 100644 --- a/client/src/javascript/components/sidebar/NotificationsButton.tsx +++ b/client/src/javascript/components/sidebar/NotificationsButton.tsx @@ -222,11 +222,7 @@ class NotificationsButton extends Component {