diff --git a/packages/jupyter-ai/src/components/chat-messages.tsx b/packages/jupyter-ai/src/components/chat-messages.tsx index c3fc0921a..aaae93a18 100644 --- a/packages/jupyter-ai/src/components/chat-messages.tsx +++ b/packages/jupyter-ai/src/components/chat-messages.tsx @@ -49,11 +49,11 @@ function sortMessages( */ const aOriginTimestamp = - a.type === 'agent' && a.reply_to in timestampsById + 'reply_to' in a && a.reply_to in timestampsById ? timestampsById[a.reply_to] : a.time; const bOriginTimestamp = - b.type === 'agent' && b.reply_to in timestampsById + 'reply_to' in b && b.reply_to in timestampsById ? timestampsById[b.reply_to] : b.time;