diff --git a/src/hooks/useSearchHighlightAndScroll.ts b/src/hooks/useSearchHighlightAndScroll.ts index 12228bbe7b86..95a953139ebe 100644 --- a/src/hooks/useSearchHighlightAndScroll.ts +++ b/src/hooks/useSearchHighlightAndScroll.ts @@ -83,7 +83,7 @@ function useSearchHighlightAndScroll({searchResults, transactions, previousTrans return; } - const newTransactionID = newTransactionIDs[0]; + const newTransactionID = newTransactionIDs.at(0) ?? ''; const newTransactionKey = `${ONYXKEYS.COLLECTION.TRANSACTION}${newTransactionID}`; setNewSearchResultKey(newTransactionKey);