diff --git a/examples/client/Locomotion/src/Components/RidePaymentDetails/index.tsx b/examples/client/Locomotion/src/Components/RidePaymentDetails/index.tsx
index 20d58058d..b4a6c42c9 100644
--- a/examples/client/Locomotion/src/Components/RidePaymentDetails/index.tsx
+++ b/examples/client/Locomotion/src/Components/RidePaymentDetails/index.tsx
@@ -35,7 +35,6 @@ const RidePaymentDetails = ({
getRidePriceCalculation,
} = useContext(RidePageContext);
- const { businessAccountId } = useContext(RidePageContext);
const { getBusinessAccountById } = PaymentContext.useContainer();
const { showPrice, loadShowPrice } = SettingContext.useContainer();
@@ -49,11 +48,9 @@ const RidePaymentDetails = ({
useEffect(() => {
updatePriceCalculation();
+ showPriceBasedOnAccount(loadShowPrice, getBusinessAccountById, ride.businessAccountId);
}, []);
- useEffect(() => {
- showPriceBasedOnAccount(loadShowPrice, getBusinessAccountById, businessAccountId);
- }, [businessAccountId]);
return (paymentMethod ? (
<>
diff --git a/examples/client/Locomotion/src/pages/RideHistory/RideCard/index.js b/examples/client/Locomotion/src/pages/RideHistory/RideCard/index.js
index b568def5c..7f89e86d6 100644
--- a/examples/client/Locomotion/src/pages/RideHistory/RideCard/index.js
+++ b/examples/client/Locomotion/src/pages/RideHistory/RideCard/index.js
@@ -11,8 +11,6 @@ import { getPriceCalculation } from '../../../context/futureRides/api';
import RidePaymentDetails from '../../../Components/RidePaymentDetails';
import PaymentContext from '../../../context/payments';
import SettingContext from '../../../context/settings';
-import { RidePageContext } from '../../../context/newRideContext';
-import showPriceBasedOnAccount from '../../../services/showPriceBasedOnAccount';
import {
DaySecTitleSubText,
DaySecTitleText,
@@ -55,13 +53,19 @@ const RideTitleCard = ({
ride, page, showTip, tip, isPaymentRejected,
}) => {
const isDebuggingEnabled = (typeof atob !== 'undefined');
- const { businessAccountId } = useContext(RidePageContext);
const { getBusinessAccountById } = PaymentContext.useContainer();
const { showPrice, loadShowPrice } = SettingContext.useContainer();
useEffect(() => {
- showPriceBasedOnAccount(loadShowPrice, getBusinessAccountById, businessAccountId);
- }, [businessAccountId]);
+ loadShowPrice();
+ }, []);
+
+ if (ride.businessAccountId) {
+ const { showPriceToMembers } = getBusinessAccountById(ride.businessAccountId);
+ ride.showPrice = showPriceToMembers;
+ } else {
+ ride.showPrice = showPrice;
+ }
const getTipButton = () => {
if (!isDebuggingEnabled && tip === null) {
@@ -126,7 +130,7 @@ const RideTitleCard = ({
) : {i18n.t(`rideHistory.ride.states.${ride.state}`)}}
- {showPrice && (
+ {ride.showPrice && (
{getFormattedPrice(ride.priceCurrency, ride.priceAmount)}
diff --git a/examples/client/Locomotion/src/services/showPriceBasedOnAccount.ts b/examples/client/Locomotion/src/services/showPriceBasedOnAccount.ts
index acf298dce..5b963f295 100644
--- a/examples/client/Locomotion/src/services/showPriceBasedOnAccount.ts
+++ b/examples/client/Locomotion/src/services/showPriceBasedOnAccount.ts
@@ -7,7 +7,7 @@ type LoadShowPriceFunction = (showPriceToMembers?: boolean) => void;
export default (
loadShowPrice: LoadShowPriceFunction,
getBusinessAccountById: GetBusinessAccountByIdFunction,
- businessAccountId: string | null,
+ businessAccountId: string | null | undefined,
) => {
if (businessAccountId) {
const { showPriceToMembers } = getBusinessAccountById(businessAccountId);