From f2b446cf10cfc2a25e52703bd437271e35202a2c Mon Sep 17 00:00:00 2001 From: zubiden <19638254+zubiden@users.noreply.github.com> Date: Sun, 22 Feb 2026 23:42:44 +0100 Subject: [PATCH] Recipient Picker: Fix error (#6647) --- src/components/common/RecipientPicker.tsx | 4 ++-- src/hooks/useCurrentOrPrev.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/common/RecipientPicker.tsx b/src/components/common/RecipientPicker.tsx index c5f55bb8c..543b0397c 100644 --- a/src/components/common/RecipientPicker.tsx +++ b/src/components/common/RecipientPicker.tsx @@ -104,7 +104,7 @@ const RecipientPicker = ({ }); const ids = useMemo(() => { - if (!isOpen) return undefined; + if (!isOpen) return []; let priorityIds = pinnedIds || []; if (currentUserId) { @@ -169,7 +169,7 @@ const RecipientPicker = ({ shouldRenderFolders, ]); - const renderingIds = useCurrentOrPrev(ids, true)!; + const renderingIds = useCurrentOrPrev(ids, true); const chatFolders = useMemo(() => { if (!shouldRenderFolders) return undefined; diff --git a/src/hooks/useCurrentOrPrev.ts b/src/hooks/useCurrentOrPrev.ts index c8900e66c..69fc69eb1 100644 --- a/src/hooks/useCurrentOrPrev.ts +++ b/src/hooks/useCurrentOrPrev.ts @@ -2,8 +2,8 @@ import usePreviousDeprecated from './usePreviousDeprecated'; export default function useCurrentOrPrev( current: T, shouldSkipUndefined = false, shouldForceCurrent = false, -): T | undefined { - const prev = usePreviousDeprecated(current, shouldSkipUndefined); +): T { + const prev = usePreviousDeprecated(current, shouldSkipUndefined) as T; // eslint-disable-next-line no-null/no-null return shouldForceCurrent || (current !== null && current !== undefined) ? current : prev;