From 9dea1ed499e6ea7f93f8d8d85461bf4ec73ff9a6 Mon Sep 17 00:00:00 2001 From: m5r Date: Sat, 25 Sep 2021 07:12:16 +0800 Subject: [PATCH] fix type errors --- app/messages/hooks/use-conversation.ts | 2 +- app/messages/hooks/use-known-recipients.ts | 4 ++++ app/phone-calls/pages/keypad.tsx | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/messages/hooks/use-conversation.ts b/app/messages/hooks/use-conversation.ts index e1ca871..a6804e3 100644 --- a/app/messages/hooks/use-conversation.ts +++ b/app/messages/hooks/use-conversation.ts @@ -8,7 +8,7 @@ export default function useConversation(recipient: string) { {}, { select(conversations) { - if (!conversations[recipient]) { + if (!conversations?.[recipient]) { return null; } diff --git a/app/messages/hooks/use-known-recipients.ts b/app/messages/hooks/use-known-recipients.ts index dc311c0..5bdd9b2 100644 --- a/app/messages/hooks/use-known-recipients.ts +++ b/app/messages/hooks/use-known-recipients.ts @@ -7,6 +7,10 @@ export default function useKnownRecipients() { {}, { select(conversations) { + if (!conversations) { + return []; + } + return Object.keys(conversations); }, }, diff --git a/app/phone-calls/pages/keypad.tsx b/app/phone-calls/pages/keypad.tsx index 39051c2..e533398 100644 --- a/app/phone-calls/pages/keypad.tsx +++ b/app/phone-calls/pages/keypad.tsx @@ -83,7 +83,7 @@ const KeypadPage: BlitzPage = () => {