From 6ce0535abd8625c198914788ad93a1f023a30991 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Thu, 26 Sep 2024 16:41:22 +0700 Subject: [PATCH] fix: using usePolicy --- src/pages/iou/request/step/IOURequestStepDistance.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/iou/request/step/IOURequestStepDistance.tsx b/src/pages/iou/request/step/IOURequestStepDistance.tsx index cea519f839ac..ac147570a4cc 100644 --- a/src/pages/iou/request/step/IOURequestStepDistance.tsx +++ b/src/pages/iou/request/step/IOURequestStepDistance.tsx @@ -16,6 +16,7 @@ import type {WithCurrentUserPersonalDetailsProps} from '@components/withCurrentU import useFetchRoute from '@hooks/useFetchRoute'; import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; +import usePolicy from '@hooks/usePolicy'; import usePrevious from '@hooks/usePrevious'; import useThemeStyles from '@hooks/useThemeStyles'; import DistanceRequestUtils from '@libs/DistanceRequestUtils'; @@ -60,7 +61,7 @@ function IOURequestStepDistance({ const {translate} = useLocalize(); const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID ?? -1}`); const [transactionBackup] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_BACKUP}${transactionID}`); - const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${report ? report?.policyID : '-1'}`); + const policy = usePolicy(report?.policyID); const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); const [skipConfirmation] = useOnyx(`${ONYXKEYS.COLLECTION.SKIP_CONFIRMATION}${transactionID}`); const [optimisticWaypoints, setOptimisticWaypoints] = useState(null);