diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js index 53753e193fb1..89324dd35485 100644 --- a/src/libs/actions/Policy.js +++ b/src/libs/actions/Policy.js @@ -73,6 +73,13 @@ Onyx.connect({ callback: (val) => (allRecentlyUsedCategories = val), }); +let networkStatus = {}; +Onyx.connect({ + key: ONYXKEYS.NETWORK, + waitForCollectionCallback: true, + callback: (val) => (networkStatus = val), +}); + /** * Stores in Onyx the policy ID of the last workspace that was accessed by the user * @param {String|null} policyID @@ -766,7 +773,7 @@ function updateWorkspaceCustomUnitAndRate(policyID, currentCustomUnit, newCustom 'UpdateWorkspaceCustomUnitAndRate', { policyID, - lastModified, + ...(!networkStatus.isOffline && {lastModified}), customUnit: JSON.stringify(newCustomUnitParam), customUnitRate: JSON.stringify(newCustomUnitParam.rates), },