From 423cff2fa8d0ed856a27c019dbf8f0f082968ab3 Mon Sep 17 00:00:00 2001 From: "P. Reis" Date: Tue, 3 Dec 2024 15:12:31 -0300 Subject: [PATCH] fix(PureStatusList): Cannot read properties of undefined (reading 'id') --- src/components/pure-status-list.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/pure-status-list.tsx b/src/components/pure-status-list.tsx index 6a8aa9064..a3075e1b5 100644 --- a/src/components/pure-status-list.tsx +++ b/src/components/pure-status-list.tsx @@ -91,11 +91,11 @@ const PureStatusList: React.FC = ({ }; const handleLoadOlder = useCallback(debounce(() => { - const maxId = lastStatusId || statuses.slice(-1)[0].id; + const maxId = lastStatusId || statuses.slice(-1)?.[0]?.id; if (onLoadMore && maxId) { onLoadMore(maxId.replace('末suggestions-', '')); } - }, 300, { edges: ['leading'] }), [onLoadMore, lastStatusId, statuses.slice(-1)[0].id]); + }, 300, { edges: ['leading'] }), [onLoadMore, lastStatusId, statuses.slice(-1)?.[0]?.id]); const selectChild = (index: number) => { node.current?.scrollIntoView({