Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix(billing): prevent duplicate mutation error toasts (#8198)
Andrew Huang1920f0880f1e
diff --git a/frontend/src/pages/organization/BillingV2Page/BillingV2Page.tsx b/frontend/src/pages/organization/BillingV2Page/BillingV2Page.tsxindex 88c1923fb4..7905651312 100644--- a/frontend/src/pages/organization/BillingV2Page/BillingV2Page.tsx+++ b/frontend/src/pages/organization/BillingV2Page/BillingV2Page.tsx@@ -80,16 +80,18 @@ export const BillingV2Page = () => {const close = () => setFlow(null);- const redirectToPortal = async () => {- try {- const url = await createPortalSession.mutateAsync({+ const redirectToPortal = () => {+ createPortalSession.mutate(+ {orgId,returnPath: window.location.pathname- });- window.location.href = url;- } catch {- createNotification({ type: "error", text: "Failed to open the billing portal." });- }+ },+ {+ onSuccess: (url) => {+ window.location.href = url;+ }+ }+ );};const onManageSubscription = () => {@@ -109,16 +111,18 @@ export const BillingV2Page = () => {const hasActiveSubscription = overview?.subState === "active";- const onUpdatePayment = async () => {- try {- const url = await addPaymentMethod.mutateAsync({+ const onUpdatePayment = () => {+ addPaymentMethod.mutate(+ {orgId,returnPath: window.location.pathname- });- window.location.href = url;- } catch {- createNotification({ type: "error", text: "Failed to open the payment portal." });- }+ },+ {+ onSuccess: (url) => {+ window.location.href = url;+ }+ }+ );};// Billing name/email and address are edited in the Stripe billing portal.diff --git a/frontend/src/pages/organization/BillingV2Page/components/ProductSheet.tsx b/frontend/src/pages/organization/BillingV2Page/components/ProductSheet.tsxindex e641686873..6fee4b7add 100644--- a/frontend/src/pages/organization/BillingV2Page/components/ProductSheet.tsx+++ b/frontend/src/pages/organization/BillingV2Page/components/ProductSheet.tsx@@ -574,7 +574,6 @@ export const ProductSheet = ({});onClose();} catch {- createNotification({ type: "error", text: `Failed to start the ${prod.name} trial.` });setTrialConfirmTier(null);}};@@ -590,7 +589,6 @@ export const ProductSheet = ({});onClose();} catch {- createNotification({ type: "error", text: `Failed to cancel the ${prod.name} trial.` });setShowCancelTrial(false);}};diff --git a/frontend/src/pages/organization/BillingV2Page/components/cards/ProductsCard.tsx b/frontend/src/pages/organization/BillingV2Page/components/cards/ProductsCard.tsxindex 8986f6761d..8a249ed6cc 100644--- a/frontend/src/pages/organization/BillingV2Page/components/cards/ProductsCard.tsx+++ b/frontend/src/pages/organization/BillingV2Page/components/cards/ProductsCard.tsx@@ -306,13 +306,15 @@ export const ProductsCard = ({// Pull the latest entitlements from the license server (busting the server cache) and refetch the// overview so the freshly-resolved products land in the UI.- const handleRefresh = async () => {- try {- await refreshEntitlements.mutateAsync({ orgId: currentOrg.id });- createNotification({ type: "success", text: "Entitlements refreshed." });- } catch {- createNotification({ type: "error", text: "Failed to refresh entitlements." });- }+ const handleRefresh = () => {+ refreshEntitlements.mutate(+ { orgId: currentOrg.id },+ {+ onSuccess: () => {+ createNotification({ type: "success", text: "Entitlements refreshed." });+ }+ }+ );};return (