Page MenuHomePhabricator

D14138.id46359.diff
No OneTemporary

D14138.id46359.diff

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
@@ -51,18 +51,15 @@
import memoize2 from '../utils/memoize.js';
import { useSelector } from '../utils/redux-utils.js';
-type ChatThreadItemBase = {
+export type ChatThreadItem = {
+type: 'chatThreadItem',
+threadInfo: ThreadInfo,
+mostRecentNonLocalMessage: ?string,
+sidebars: $ReadOnlyArray<SidebarItem>,
+pendingPersonalThreadUserInfo?: UserInfo,
-};
-export type ChatThreadItem = $ReadOnly<{
- ...ChatThreadItemBase,
+lastUpdatedTime: number,
+lastUpdatedTimeIncludingSidebars: number,
-}>;
+};
const messageInfoSelector: (state: BaseAppState<>) => {
+[id: string]: ?MessageInfo,
@@ -82,13 +79,13 @@
);
}
-type CreatedChatThreadItem = $ReadOnly<{
- ...ChatThreadItemBase,
- +lastUpdatedAtLeastTime: number,
+type CreatedChatThreadItem = {
+ +threadInfo: ThreadInfo,
+lastUpdatedAtLeastTimeIncludingSidebars: number,
+lastUpdatedAtMostTimeIncludingSidebars: number,
+ +initialChatThreadItem: ChatThreadItem,
+getFinalChatThreadItem: () => Promise<ChatThreadItem>,
-}>;
+};
function useCreateChatThreadItem(): ThreadInfo => CreatedChatThreadItem {
const messageInfos = useSelector(messageInfoSelector);
const sidebarInfos = useSidebarInfos();
@@ -153,13 +150,19 @@
: lastUpdatedAtMostTime;
const allInitialSidebarItems = getAllInitialSidebarItems(sidebars);
-
- return {
+ const initialChatThreadItem = {
...chatThreadItemBase,
sidebars: getSidebarItems(allInitialSidebarItems),
- lastUpdatedAtLeastTime,
+ lastUpdatedTime: lastUpdatedAtLeastTime,
+ lastUpdatedTimeIncludingSidebars:
+ lastUpdatedAtLeastTimeIncludingSidebars,
+ };
+
+ return {
+ threadInfo,
lastUpdatedAtLeastTimeIncludingSidebars,
lastUpdatedAtMostTimeIncludingSidebars,
+ initialChatThreadItem,
getFinalChatThreadItem,
};
},
@@ -194,21 +197,9 @@
const initialChatThreadItems = React.useMemo(
() =>
- createdChatThreadItems.map(createdChatThreadItem => {
- const {
- lastUpdatedAtLeastTime,
- lastUpdatedAtLeastTimeIncludingSidebars,
- lastUpdatedAtMostTimeIncludingSidebars,
- getFinalChatThreadItem,
- ...rest
- } = createdChatThreadItem;
- return {
- ...rest,
- lastUpdatedTime: lastUpdatedAtLeastTime,
- lastUpdatedTimeIncludingSidebars:
- lastUpdatedAtLeastTimeIncludingSidebars,
- };
- }),
+ createdChatThreadItems.map(
+ createdChatThreadItem => createdChatThreadItem.initialChatThreadItem,
+ ),
[createdChatThreadItems],
);

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 22, 7:24 PM (16 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2672788
Default Alt Text
D14138.id46359.diff (2 KB)

Event Timeline