Skip to content

Commit

Permalink
return early
Browse files Browse the repository at this point in the history
  • Loading branch information
luacmartins committed Jun 6, 2024
1 parent 937b638 commit a45dab2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/components/SelectionList/Search/ReportListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ function ReportListItem<TItem extends ListItem>({
const {isLargeScreenWidth} = useWindowDimensions();
const StyleUtils = useStyleUtils();

if (reportItem.transactions.length === 0) {
return;
}

const listItemPressableStyle = [styles.selectionListPressableItemWrapper, styles.pv3, item.isSelected && styles.activeComponentBG, isFocused && styles.sidebarLinkActive];

const handleOnButtonPress = () => {
Expand All @@ -95,18 +99,14 @@ function ReportListItem<TItem extends ListItem>({
return null;
}

const participantFrom = reportItem.transactions[0]?.from;
const participantTo = reportItem.transactions[0]?.to;
const participantFrom = reportItem.transactions[0].from;
const participantTo = reportItem.transactions[0].to;

// These values should come as part of the item via SearchUtils.getSections() but ReportListItem is not yet 100% handled
// This will be simplified in future once sorting of ReportListItem is done
const participantFromDisplayName = participantFrom?.name ?? participantFrom?.displayName ?? participantFrom?.login ?? '';
const participantToDisplayName = participantTo?.name ?? participantTo?.displayName ?? participantTo?.login ?? '';

if (reportItem.transactions.length === 0) {
return;
}

if (reportItem.transactions.length === 1) {
const transactionItem = reportItem.transactions[0];

Expand Down

0 comments on commit a45dab2

Please sign in to comment.