Skip to content

Commit 3f9089f

Browse files
committed
Show an error to the user when their addon upgrade payment fails
1 parent 2462c80 commit 3f9089f

File tree

1 file changed

+7
-3
lines changed
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.concurrency

1 file changed

+7
-3
lines changed

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.concurrency/route.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ function Upgradable({
291291
}: ConcurrencyResult) {
292292
const lastSubmission = useActionData();
293293
const [form, { environments: formEnvironments }] = useForm({
294-
id: "purchase-concurrency",
294+
id: "allocate-concurrency",
295295
// TODO: type this
296296
lastSubmission: lastSubmission as any,
297297
onValidate({ formData }) {
@@ -446,7 +446,9 @@ function Upgradable({
446446
</TableRow>
447447
</TableBody>
448448
</Table>
449-
<FormError id={formEnvironments.id}>{formEnvironments.error}</FormError>
449+
<FormError id={formEnvironments.id}>
450+
{formEnvironments.error ?? formEnvironments.initialError?.[""]?.[0]}
451+
</FormError>
450452
</div>
451453
<Form className="flex flex-col gap-2" method="post" {...form.props} id="allocate">
452454
<input type="hidden" name="action" value="allocate" />
@@ -664,7 +666,9 @@ function PurchaseConcurrencyModal({
664666
onChange={(e) => setAmountValue(Number(e.target.value))}
665667
disabled={isLoading}
666668
/>
667-
<FormError id={amount.errorId}>{amount.error}</FormError>
669+
<FormError id={amount.errorId}>
670+
{amount.error ?? amount.initialError?.[""]?.[0]}
671+
</FormError>
668672
<FormError>{form.error}</FormError>
669673
</InputGroup>
670674
</Fieldset>

0 commit comments

Comments
 (0)