Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F2902865
D10558.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D10558.diff
View Options
diff --git a/lib/reducers/thread-reducer.js b/lib/reducers/thread-reducer.js
--- a/lib/reducers/thread-reducer.js
+++ b/lib/reducers/thread-reducer.js
@@ -372,60 +372,40 @@
} else if (action.type === setThreadUnreadStatusActionTypes.started) {
const { threadID, unread } = action.payload;
const threadInfo = state.threadInfos[threadID];
- // TODO (atul): Try to get rid of this ridiculous branching.
- if (threadInfo.minimallyEncoded) {
- const updatedThreadInfo = {
- ...threadInfo,
- currentUser: {
- ...threadInfo.currentUser,
- unread,
- },
- };
- const threadStoreOperations = [
- {
- type: 'replace',
- payload: {
- id: threadID,
- threadInfo: updatedThreadInfo,
+ const updatedThreadInfo = threadInfo.minimallyEncoded
+ ? {
+ ...threadInfo,
+ currentUser: {
+ ...threadInfo.currentUser,
+ unread,
},
- },
- ];
- const updatedThreadStore = processThreadStoreOperations(
- state,
- threadStoreOperations,
- );
- return {
- threadStore: updatedThreadStore,
- newThreadInconsistencies: [],
- threadStoreOperations,
- };
- } else {
- const updatedThreadInfo = {
- ...threadInfo,
- currentUser: {
- ...threadInfo.currentUser,
- unread,
- },
- };
- const threadStoreOperations = [
- {
- type: 'replace',
- payload: {
- id: threadID,
- threadInfo: updatedThreadInfo,
+ }
+ : {
+ ...threadInfo,
+ currentUser: {
+ ...threadInfo.currentUser,
+ unread,
},
+ };
+
+ const threadStoreOperations = [
+ {
+ type: 'replace',
+ payload: {
+ id: threadID,
+ threadInfo: updatedThreadInfo,
},
- ];
- const updatedThreadStore = processThreadStoreOperations(
- state,
- threadStoreOperations,
- );
- return {
- threadStore: updatedThreadStore,
- newThreadInconsistencies: [],
- threadStoreOperations,
- };
- }
+ },
+ ];
+ const updatedThreadStore = processThreadStoreOperations(
+ state,
+ threadStoreOperations,
+ );
+ return {
+ threadStore: updatedThreadStore,
+ newThreadInconsistencies: [],
+ threadStoreOperations,
+ };
} else if (action.type === setThreadUnreadStatusActionTypes.success) {
const { threadID, resetToUnread } = action.payload;
const currentUser = state.threadInfos[threadID].currentUser;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 6, 7:27 PM (21 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2250711
Default Alt Text
D10558.diff (2 KB)
Attached To
Mode
D10558: [lib] Reduce branching for `setThreadUnreadStatusActionTypes.started` in `thread-reducer`
Attached
Detach File
Event Timeline
Log In to Comment