Skip to content

Commit 7284758

Browse files
committed
fix: set suppressBanner before optimistic entries to prevent flash
1 parent 483fac5 commit 7284758

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,12 @@ export const ManageMembersDialog = ({
473473
const failed = await inviteMembers(emails, workspace.id, relation);
474474
setInviting(false);
475475

476+
// Suppress the banner before optimistic entries trigger a re-render,
477+
// otherwise React renders the new member count with the old maxSeats.
478+
if (boughtExtraSeats) {
479+
setSuppressBanner(true);
480+
}
481+
476482
// Add optimistic entries only for emails that actually succeeded so that
477483
// non-existent or already-member emails never flicker into the list.
478484
const failedEmails = new Set(failed.map((f) => f.split(":")[0].trim()));
@@ -493,9 +499,8 @@ export const ManageMembersDialog = ({
493499
}
494500

495501
// When the invite triggered a Stripe Seats subscription, the webhook
496-
// needs time to update the DB. Suppress the banner and delay refetch.
502+
// needs time to update the DB. Delay refetch; banner already suppressed.
497503
if (boughtExtraSeats && succeeded.length > 0) {
498-
setSuppressBanner(true);
499504
setTimeout(() => {
500505
handleRefresh();
501506
revalidator.revalidate();

0 commit comments

Comments
 (0)