From 61d05467b8b05302b8abd1099e17905c0da35188 Mon Sep 17 00:00:00 2001 From: M Fahru Date: Thu, 30 Jan 2025 09:52:06 -0700 Subject: [PATCH] [web] Fix bug where VAT value isn't retained properly when changing plan without reloading (#23211) Fix VAT info is not properly updated when changing plan without reloading. I removed `setPlan` and created a new function: `updatePlan`. In the new function, I call the recurly function directly and the tracking code. This way, we can be sure that changing plan won't call useLayoutEffect. Also, remove unused `useState` on the `planCode` GitOrigin-RevId: 0d6d9fac32c15dcf13e35cf9cd9161aa07581938 --- services/web/types/subscription/payment-context-value.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/services/web/types/subscription/payment-context-value.tsx b/services/web/types/subscription/payment-context-value.tsx index cb0ce14c9f..79dec23ef5 100644 --- a/services/web/types/subscription/payment-context-value.tsx +++ b/services/web/types/subscription/payment-context-value.tsx @@ -30,9 +30,6 @@ export type PaymentContextValue = { > plan: Plan planCode: string - setPlanCode: React.Dispatch< - React.SetStateAction - > planName: string planOffersFreeTrial: boolean pricing: React.MutableRefObject @@ -73,4 +70,5 @@ export type PaymentContextValue = { setStudentConfirmationChecked: React.Dispatch< React.SetStateAction > + updatePlan: (newPlanCode: string) => void }