Skip to content
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
11 changes: 1 addition & 10 deletions src/libs/IOUUtils.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
import Onyx from 'react-native-onyx';
import lodashGet from 'lodash/get';
import ONYXKEYS from '../ONYXKEYS';
import CONST from '../CONST';

let isNetworkOffline = false;
Onyx.connect({
key: ONYXKEYS.NETWORK,
callback: val => isNetworkOffline = lodashGet(val, 'isOffline', false),
});

/**
* Calculates the amount per user given a list of participants
* @param {Array} participants - List of logins for the participants in the chat. It should not include the current user's login.
Expand Down Expand Up @@ -50,7 +41,7 @@ function calculateAmount(participants, total, isDefaultUser = false) {
* @returns {Object}
*/
function updateIOUOwnerAndTotal(iouReport, actorEmail, amount, currency, type = CONST.IOU.REPORT_ACTION_TYPE.CREATE) {
if (currency !== iouReport.currency && isNetworkOffline) {
if (currency !== iouReport.currency) {
return iouReport;
}

Expand Down