Skip to content

Commit 483fac5

Browse files
committed
fix: suppress over-capacity banner while waiting for webhook
1 parent 49697c4 commit 483fac5

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

apps/builder/app/dashboard/workspace/manage-members-dialog.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ export const ManageMembersDialog = ({
429429
relation: Role;
430430
extraSeats: number;
431431
}>();
432+
const [suppressBanner, setSuppressBanner] = useState(false);
432433
const formRef = useRef<HTMLFormElement>(null);
433434

434435
const { load, data } = trpcClient.workspace.listMembers.useQuery();
@@ -492,11 +493,13 @@ export const ManageMembersDialog = ({
492493
}
493494

494495
// When the invite triggered a Stripe Seats subscription, the webhook
495-
// needs time to update the DB. Delay refetch so the banner doesn't flash.
496+
// needs time to update the DB. Suppress the banner and delay refetch.
496497
if (boughtExtraSeats && succeeded.length > 0) {
498+
setSuppressBanner(true);
497499
setTimeout(() => {
498500
handleRefresh();
499501
revalidator.revalidate();
502+
setSuppressBanner(false);
500503
}, 4000);
501504
return;
502505
}
@@ -597,7 +600,7 @@ export const ManageMembersDialog = ({
597600
</Flex>
598601
</Flex>
599602
)}
600-
{isOwner && overCapacity > 0 && (
603+
{isOwner && overCapacity > 0 && suppressBanner === false && (
601604
<PanelBanner variant="warning">
602605
<Flex direction="column" gap="2">
603606
<Text>

0 commit comments

Comments
 (0)