fix(PureStatusList): Cannot read properties of undefined (reading 'id')

This commit is contained in:
P. Reis 2024-12-03 15:12:31 -03:00
parent 6433194395
commit 423cff2fa8
1 changed files with 2 additions and 2 deletions

View File

@ -91,11 +91,11 @@ const PureStatusList: React.FC<IPureStatusList> = ({
}; };
const handleLoadOlder = useCallback(debounce(() => { const handleLoadOlder = useCallback(debounce(() => {
const maxId = lastStatusId || statuses.slice(-1)[0].id; const maxId = lastStatusId || statuses.slice(-1)?.[0]?.id;
if (onLoadMore && maxId) { if (onLoadMore && maxId) {
onLoadMore(maxId.replace('末suggestions-', '')); 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) => { const selectChild = (index: number) => {
node.current?.scrollIntoView({ node.current?.scrollIntoView({