Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3355366
D3431.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D3431.diff
View Options
diff --git a/lib/hooks/toggle-unread-status.js b/lib/hooks/toggle-unread-status.js
--- a/lib/hooks/toggle-unread-status.js
+++ b/lib/hooks/toggle-unread-status.js
@@ -19,16 +19,16 @@
afterAction: () => void,
): () => void {
const dispatchActionPromise = useDispatchActionPromise();
+ const { currentUser } = threadInfo;
const boundSetThreadUnreadStatus: (
request: SetThreadUnreadStatusRequest,
) => Promise<SetThreadUnreadStatusPayload> = useServerCall(
setThreadUnreadStatus,
);
const toggleUnreadStatus = React.useCallback(() => {
- const { unread } = threadInfo.currentUser;
const request = {
threadID: threadInfo.id,
- unread: !unread,
+ unread: !currentUser.unread,
latestMessage: mostRecentNonLocalMessage,
};
dispatchActionPromise(
@@ -37,12 +37,13 @@
undefined,
{
threadID: threadInfo.id,
- unread: !unread,
+ unread: !currentUser.unread,
},
);
afterAction();
}, [
- threadInfo,
+ threadInfo.id,
+ currentUser.unread,
mostRecentNonLocalMessage,
dispatchActionPromise,
afterAction,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 2:24 PM (21 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2576290
Default Alt Text
D3431.diff (1 KB)
Attached To
Mode
D3431: [lib] [refactor] useToggleUnreadStatus hook, fix up deps array after move
Attached
Detach File
Event Timeline
Log In to Comment