From b26c45de8b2e6d8aba44406646ea635f8d9d922e Mon Sep 17 00:00:00 2001 From: Jigar Patel Date: Mon, 2 Dec 2024 23:54:34 +0530 Subject: [PATCH] fix(provider): pricing update fix --- .../src/components/become-provider/ProviderPricing.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/provider-console/src/components/become-provider/ProviderPricing.tsx b/apps/provider-console/src/components/become-provider/ProviderPricing.tsx index 354ffbc8c..370c7052a 100644 --- a/apps/provider-console/src/components/become-provider/ProviderPricing.tsx +++ b/apps/provider-console/src/components/become-provider/ProviderPricing.tsx @@ -55,6 +55,7 @@ const providerPricingSchema = z.object({ type ProviderPricingValues = z.infer; export const ProviderPricing: React.FC = ({ onComplete, editMode = false, existingPricing, disabled = false, providerDetails }) => { + console.log(existingPricing) const [providerProcess, setProviderProcess] = useAtom(providerProcessStore.providerProcessAtom); const { activeControlMachine } = useControlMachine(); const [showSuccess, setShowSuccess] = React.useState(false); @@ -136,6 +137,12 @@ export const ProviderPricing: React.FC = ({ onComplete, ed } }); + useEffect(() => { + if (editMode && existingPricing) { + form.reset(existingPricing); + } + }, [editMode, existingPricing, form]); + const watchValues = form.watch(); const calculateEstimatedEarnings = useCallback(