Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabling loading new participants profiles in the confirmation page #45362

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions src/components/MoneyRequestConfirmationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,18 @@ function MoneyRequestConfirmationList({

const isCategoryRequired = !!policy?.requiresCategory;

const shouldDisableParticipant = (participant: Participant): boolean => {
if (ReportUtils.isDraftReport(participant.reportID)) {
return true;
}

if (!participant.isInvoiceRoom && !participant.isPolicyExpenseChat && !participant.isSelfDM && ReportUtils.isOptimisticPersonalDetail(participant.accountID ?? -1)) {
return true;
}

return false;
};

useEffect(() => {
if (shouldDisplayFieldError && didConfirmSplit) {
setFormError('iou.error.genericSmartscanFailureMessage');
Expand Down Expand Up @@ -430,6 +442,7 @@ function MoneyRequestConfirmationList({
return {
...participantOption,
isSelected: false,
isInteractive: !shouldDisableParticipant(participantOption),
rightElement: (
<View style={[styles.flexWrap, styles.pl2]}>
<Text style={[styles.textLabel]}>{amount ? CurrencyUtils.convertToDisplayString(amount, iouCurrencyCode) : ''}</Text>
Expand All @@ -448,6 +461,7 @@ function MoneyRequestConfirmationList({
...participantOption,
tabIndex: -1,
isSelected: false,
isInteractive: !shouldDisableParticipant(participantOption),
rightElement: (
<MoneyRequestAmountInput
autoGrow={false}
Expand Down Expand Up @@ -531,18 +545,6 @@ function MoneyRequestConfirmationList({
],
);

const shouldDisableParticipant = (participant: Participant): boolean => {
if (ReportUtils.isDraftReport(participant.reportID)) {
return true;
}

if (!participant.isInvoiceRoom && !participant.isPolicyExpenseChat && !participant.isSelfDM && ReportUtils.isOptimisticPersonalDetail(participant.accountID ?? -1)) {
return true;
}

return false;
};

const sections = useMemo(() => {
const options: Array<SectionListDataType<MoneyRequestConfirmationListItem>> = [];
if (isTypeSplit) {
Expand Down
Loading