Skip to content

Commit 049d126

Browse files
committed
Modals don’t trigger when you upgrade
1 parent fd01de8 commit 049d126

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

apps/webapp/app/routes/resources.orgs.$organizationSlug.select-plan.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
SetPlanBody,
1818
SubscriptionResult,
1919
} from "@trigger.dev/platform/v3";
20-
import React, { useState } from "react";
20+
import React, { useEffect, useState } from "react";
2121
import { inspect } from "util";
2222
import { z } from "zod";
2323
import { DefinitionTip } from "~/components/DefinitionTooltip";
@@ -322,6 +322,10 @@ export function TierFree({
322322
const [isLackingFeaturesChecked, setIsLackingFeaturesChecked] = useState(false);
323323
const status = subscription?.freeTierStatus ?? "requires_connect";
324324

325+
useEffect(() => {
326+
setIsDialogOpen(false);
327+
}, [subscription]);
328+
325329
return (
326330
<TierContainer>
327331
<div className="relative">
@@ -395,7 +399,7 @@ export function TierFree({
395399
<input type="hidden" name="type" value="free" />
396400
<input type="hidden" name="callerPath" value={location.pathname} />
397401
<DialogHeader>Downgrade plan</DialogHeader>
398-
<div className="flex items-start gap-3 pb-6 pr-4 pt-6">
402+
<div className="flex items-start gap-3 pb-6 pr-4 pt-8">
399403
<ArrowDownCircleIcon className="size-12 min-w-12 text-error" />
400404
<Paragraph variant="base/bright" className="text-text-bright">
401405
Are you sure you want to downgrade? If you do, you will retain your current
@@ -519,6 +523,10 @@ export function TierHobby({
519523
const isLoading = navigation.formAction === formAction;
520524
const [isDialogOpen, setIsDialogOpen] = useState(false);
521525

526+
useEffect(() => {
527+
setIsDialogOpen(false);
528+
}, [subscription]);
529+
522530
return (
523531
<TierContainer isHighlighted={isHighlighted}>
524532
<PricingHeader title={plan.title} isHighlighted={isHighlighted} cost={plan.tierPrice} />
@@ -546,7 +554,7 @@ export function TierHobby({
546554
<ArrowDownCircleIcon className="size-12 text-blue-500" />
547555
</span>
548556
<Paragraph variant="base/bright" className="text-text-bright">
549-
By downgrading you will lose access to your current plans features and your
557+
By downgrading you will lose access to your current plan's features and your
550558
included credits will be reduced.
551559
</Paragraph>
552560
</div>

0 commit comments

Comments
 (0)