Page MenuHomePhabricator

D3337.diff
No OneTemporary

D3337.diff

diff --git a/web/app.react.js b/web/app.react.js
--- a/web/app.react.js
+++ b/web/app.react.js
@@ -17,7 +17,10 @@
createLoadingStatusSelector,
combineLoadingStatuses,
} from 'lib/selectors/loading-selectors';
-import { mostRecentReadThreadSelector } from 'lib/selectors/thread-selectors';
+import {
+ mostRecentReadThreadSelector,
+ unreadCount,
+} from 'lib/selectors/thread-selectors';
import { isLoggedIn } from 'lib/selectors/user-selectors';
import type { LoadingStatus } from 'lib/types/loading-types';
import type { Dispatch } from 'lib/types/redux-types';
@@ -39,6 +42,7 @@
import Splash from './splash/splash.react';
import './typography.css';
import css from './style.css';
+import getTitle from './title/getTitle';
import { type NavInfo, updateNavInfoActionType } from './types/nav-types';
import { canonicalURLFromReduxState, navInfoFromURL } from './url-utils';
@@ -207,6 +211,11 @@
!!state.threadStore.threadInfos[activeChatThreadID]?.currentUser.unread,
);
+ const boundUnreadCount = useSelector(unreadCount);
+ React.useEffect(() => {
+ document.title = getTitle(boundUnreadCount);
+ }, [boundUnreadCount]);
+
const dispatch = useDispatch();
const modalContext = useModalContext();
diff --git a/web/sidebar/app-switcher.react.js b/web/sidebar/app-switcher.react.js
--- a/web/sidebar/app-switcher.react.js
+++ b/web/sidebar/app-switcher.react.js
@@ -12,7 +12,6 @@
import { useSelector } from '../redux/redux-utils';
import SWMansionIcon from '../SWMansionIcon.react';
-import getTitle from '../title/getTitle';
import { updateNavInfoActionType } from '../types/nav-types';
import css from './left-layout-aside.css';
@@ -31,13 +30,8 @@
state => state.currentUserInfo && state.currentUserInfo.id,
);
- const boundUnreadCount = useSelector(unreadCount);
const isCalendarEnabled = useSelector(state => state.enabledApps.calendar);
- React.useEffect(() => {
- document.title = getTitle(boundUnreadCount);
- }, [boundUnreadCount]);
-
const dispatch = useDispatch();
const onClickCalendar = React.useCallback(
@@ -85,6 +79,8 @@
[dispatch],
);
+ const boundUnreadCount = useSelector(unreadCount);
+
invariant(viewerID, 'should be set');
let chatBadge = null;
if (boundUnreadCount > 0) {

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 19, 10:59 AM (21 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2676865
Default Alt Text
D3337.diff (2 KB)

Event Timeline