Page MenuHomePhabricator

D4042.id12752.diff
No OneTemporary

D4042.id12752.diff

diff --git a/web/modals/threads/notifications/notifications-modal.react.js b/web/modals/threads/notifications/notifications-modal.react.js
--- a/web/modals/threads/notifications/notifications-modal.react.js
+++ b/web/modals/threads/notifications/notifications-modal.react.js
@@ -41,10 +41,21 @@
return 'focused';
}, [subscription.home, subscription.pushNotifs]);
- const [
- notificationSettings,
- setNotificationSettings,
- ] = React.useState<NotificationSettings>(initialThreadSetting);
+ const [notificationSettings, setNotificationSettings] =
+ React.useState<NotificationSettings>(initialThreadSetting);
+
+ const onFocusedSelected = React.useCallback(
+ () => setNotificationSettings('focused'),
+ [],
+ );
+ const onBadgeOnlySelected = React.useCallback(
+ () => setNotificationSettings('badge-only'),
+ [],
+ );
+ const onBackgroundSelected = React.useCallback(
+ () => setNotificationSettings('background'),
+ [],
+ );
const notificationIconStyle = React.useMemo(() => ({ width: 'auto' }), []);
@@ -68,10 +79,10 @@
title="Focused (enabled)"
description={description}
icon={icon}
- onSelect={() => setNotificationSettings('focused')}
+ onSelect={onFocusedSelected}
/>
);
- }, [isFocusedSelected, notificationIconStyle]);
+ }, [isFocusedSelected, notificationIconStyle, onFocusedSelected]);
const isFocusedBadgeOnlySelected = notificationSettings === 'badge-only';
const focusedBadgeOnlyItem = React.useMemo(() => {
@@ -93,10 +104,10 @@
title="Focused (badge only)"
description={description}
icon={icon}
- onSelect={() => setNotificationSettings('badge-only')}
+ onSelect={onBadgeOnlySelected}
/>
);
- }, [isFocusedBadgeOnlySelected, notificationIconStyle]);
+ }, [isFocusedBadgeOnlySelected, notificationIconStyle, onBadgeOnlySelected]);
const isBackgroundSelected = notificationSettings === 'background';
const backgroundItem = React.useMemo(() => {
@@ -118,10 +129,10 @@
title="Background"
description={description}
icon={icon}
- onSelect={() => setNotificationSettings('background')}
+ onSelect={onBackgroundSelected}
/>
);
- }, [isBackgroundSelected, notificationIconStyle]);
+ }, [isBackgroundSelected, notificationIconStyle, onBackgroundSelected]);
const dispatchActionPromise = useDispatchActionPromise();

File Metadata

Mime Type
text/plain
Expires
Thu, Sep 19, 3:47 PM (7 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2140424
Default Alt Text
D4042.id12752.diff (2 KB)

Event Timeline