Skip to content

Commit 35ae9d1

Browse files
committed
fix #7988 -- chatroom crash
1 parent 8cd1e7c commit 35ae9d1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/packages/frontend/chat/chat-log.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ export function MessageList({
540540
// checking on folding state if it isn't a thread.
541541
const is_folded = is_thread && isFolded(messages, message, account_id);
542542
const is_thread_body = is_thread && message.get("reply_to") != null;
543-
const h = virtuosoHeightsRef.current[index];
543+
const h = virtuosoHeightsRef.current?.[index];
544544

545545
return (
546546
<div
@@ -552,7 +552,7 @@ export function MessageList({
552552
<DivTempHeight height={h ? `${h}px` : undefined}>
553553
<Message
554554
messages={messages}
555-
numChildren={numChildren[message.get("date").valueOf()]}
555+
numChildren={numChildren?.[message.get("date").valueOf()]}
556556
key={date}
557557
index={index}
558558
account_id={account_id}

src/packages/frontend/chat/viewer.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default function Viewer({
2828
}, [doc]);
2929
const user_map = useTypedRedux("users", "user_map");
3030
const account_id = useTypedRedux("account", "account_id");
31-
const { dates: sortedDates } = useMemo(() => {
31+
const { dates: sortedDates, numChildren } = useMemo(() => {
3232
return getSortedDates(messages, "", account_id, undefined);
3333
}, [messages]);
3434

@@ -40,6 +40,7 @@ export default function Viewer({
4040
fontSize={font_size}
4141
mode="standalone"
4242
sortedDates={sortedDates}
43+
numChildren={numChildren}
4344
/>
4445
);
4546
}

0 commit comments

Comments
 (0)