Skip to content

Commit

Permalink
Merge pull request #43320 from Expensify/cmartins-fixCrashOnDistanceRate
Browse files Browse the repository at this point in the history
  • Loading branch information
luacmartins authored Jun 7, 2024
2 parents c7bb3bf + a5cd545 commit c44edc5
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ function PolicyDistanceRateDetailsPage({policy, route}: PolicyDistanceRateDetail
const taxRateExternalID = rate.attributes?.taxRateExternalID;

const isDistanceTrackTaxEnabled = !!customUnit?.attributes?.taxEnabled;
const taxRate = taxRateExternalID ? `${policy?.taxRates?.taxes[taxRateExternalID].name} (${policy?.taxRates?.taxes[taxRateExternalID].value})` : '';
const taxRate =
taxRateExternalID && policy?.taxRates?.taxes[taxRateExternalID] ? `${policy?.taxRates?.taxes[taxRateExternalID]?.name} (${policy?.taxRates?.taxes[taxRateExternalID]?.value})` : '';
// Rates can be disabled or deleted as long as in the remaining rates there is always at least one enabled rate and there are no pending delete action
const canDisableOrDeleteRate = Object.values(customUnit?.rates ?? {}).some(
(distanceRate: Rate) => distanceRate?.enabled && rateID !== distanceRate?.customUnitRateID && distanceRate?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE,
Expand Down

0 comments on commit c44edc5

Please sign in to comment.