Skip to content

Commit

Permalink
Adding UI filter to exclude delete pending items to be sent to FlatLi…
Browse files Browse the repository at this point in the history
…st when online

Reference: Expensify#14262
  • Loading branch information
abdulrahuman5196 committed Jan 23, 2023
1 parent 309a240 commit 378dffc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/pages/settings/Payments/PaymentMethodList.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import PropTypes from 'prop-types';
import {FlatList} from 'react-native';
import lodashGet from 'lodash/get';
import {withOnyx} from 'react-native-onyx';
import {withNetwork} from '../../../components/OnyxProvider';
import styles from '../../../styles/styles';
import * as StyleUtils from '../../../styles/StyleUtils';
import MenuItem from '../../../components/MenuItem';
Expand Down Expand Up @@ -126,6 +127,11 @@ class PaymentMethodList extends Component {
combinedPaymentMethods = _.filter(combinedPaymentMethods, paymentMethod => paymentMethod.accountType === this.props.filterType);
}

if (!this.props.network.isOffline) {
combinedPaymentMethods = _.filter(combinedPaymentMethods, paymentMethod => paymentMethod.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE
|| !_.isEmpty(paymentMethod.errors));
}

combinedPaymentMethods = _.map(combinedPaymentMethods, paymentMethod => ({
...paymentMethod,
onPress: e => this.props.onPress(e, paymentMethod.accountType, paymentMethod.accountData, paymentMethod.isDefault, paymentMethod.methodID),
Expand Down Expand Up @@ -258,6 +264,7 @@ PaymentMethodList.defaultProps = defaultProps;

export default compose(
withLocalize,
withNetwork(),
withOnyx({
bankAccountList: {
key: ONYXKEYS.BANK_ACCOUNT_LIST,
Expand Down

0 comments on commit 378dffc

Please sign in to comment.