From 166be37b74688c52faabc127696b378a38d9735e Mon Sep 17 00:00:00 2001 From: Alfredo Gallardo Date: Fri, 1 Dec 2023 15:57:40 -0300 Subject: [PATCH] - fix: crash when lastMessage is null --- apps/shinkai-visor/src/components/inboxes/inboxes.tsx | 6 +++--- libs/shinkai-message-ts/src/models/ShinkaiMessage.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/shinkai-visor/src/components/inboxes/inboxes.tsx b/apps/shinkai-visor/src/components/inboxes/inboxes.tsx index 23e8e15df..6a2aed180 100644 --- a/apps/shinkai-visor/src/components/inboxes/inboxes.tsx +++ b/apps/shinkai-visor/src/components/inboxes/inboxes.tsx @@ -66,7 +66,7 @@ export const Inboxes = () => { const navigateToInbox = (inbox: { inbox_id: string; custom_name: string; - last_message: ShinkaiMessage; + last_message?: ShinkaiMessage; }) => { history.push(`/inboxes/${encodeURIComponent(inbox.inbox_id)}`, { inbox }); }; @@ -136,8 +136,8 @@ export const Inboxes = () => { - - {inbox.last_message.external_metadata + + {inbox.last_message?.external_metadata ?.scheduled_time && formatDateToMonthAndDay( new Date( diff --git a/libs/shinkai-message-ts/src/models/ShinkaiMessage.ts b/libs/shinkai-message-ts/src/models/ShinkaiMessage.ts index e329b3fc5..4fdcfe985 100644 --- a/libs/shinkai-message-ts/src/models/ShinkaiMessage.ts +++ b/libs/shinkai-message-ts/src/models/ShinkaiMessage.ts @@ -54,5 +54,5 @@ export interface RegistrationCode { export type SmartInbox = { custom_name: string; inbox_id: string; - last_message: ShinkaiMessage; + last_message?: ShinkaiMessage; }; \ No newline at end of file