Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3327365
D13984.id45913.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
D13984.id45913.diff
View Options
diff --git a/lib/hooks/sidebar-hooks.js b/lib/hooks/sidebar-hooks.js
--- a/lib/hooks/sidebar-hooks.js
+++ b/lib/hooks/sidebar-hooks.js
@@ -44,7 +44,9 @@
mostRecentNonLocalMessage,
});
}
- result[parentID] = _orderBy('lastUpdatedTime')('desc')(sidebarInfos);
+ result[parentID] = _orderBy('lastUpdatedAtLeastTime')('desc')(
+ sidebarInfos,
+ );
}
return result;
}, [childThreadInfoByParentID, messageStore, getLastUpdatedTimes]);
diff --git a/lib/selectors/chat-selectors.js b/lib/selectors/chat-selectors.js
--- a/lib/selectors/chat-selectors.js
+++ b/lib/selectors/chat-selectors.js
@@ -115,12 +115,13 @@
: lastUpdatedAtLeastTime;
const lastUpdatedTimeIncludingSidebars = (async () => {
- if (sidebars.length === 0) {
- return await lastUpdatedTime;
- }
- const [lastUpdatedTimeResult, sidebarLastUpdatedTimeResult] =
- await Promise.all([lastUpdatedTime, sidebars[0].lastUpdatedTime]);
- return Math.max(lastUpdatedTimeResult, sidebarLastUpdatedTimeResult);
+ const lastUpdatedTimePromises = [
+ lastUpdatedTime,
+ ...sidebars.map(sidebar => sidebar.lastUpdatedTime),
+ ];
+ const lastUpdatedTimes = await Promise.all(lastUpdatedTimePromises);
+ const max = lastUpdatedTimes.reduce((a, b) => Math.max(a, b), -1);
+ return max;
})();
const allInitialSidebarItems = getAllInitialSidebarItems(sidebars);
diff --git a/lib/shared/sidebar-item-utils.js b/lib/shared/sidebar-item-utils.js
--- a/lib/shared/sidebar-item-utils.js
+++ b/lib/shared/sidebar-item-utils.js
@@ -1,5 +1,7 @@
// @flow
+import _orderBy from 'lodash/fp/orderBy.js';
+
import type { ThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js';
import {
maxReadSidebars,
@@ -94,7 +96,8 @@
lastUpdatedTime: finalLastUpdatedTime,
};
});
- return await Promise.all(allSidebarItemPromises);
+ const sidebarItems = await Promise.all(allSidebarItemPromises);
+ return _orderBy('lastUpdatedTime')('desc')(sidebarItems);
}
export { getSidebarItems, getAllInitialSidebarItems, getAllFinalSidebarItems };
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 21, 9:20 AM (6 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2555471
Default Alt Text
D13984.id45913.diff (2 KB)
Attached To
Mode
D13984: [lib] Fix incorrect timestamps for sidebars
Attached
Detach File
Event Timeline
Log In to Comment