Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(console): manually trigger usage api updates #6473

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { useAuthedCloudApi } from '@/cloud/hooks/use-cloud-api';
import type { InvitationResponse, TenantInvitationResponse } from '@/cloud/types/router';
import Breakable from '@/components/Breakable';
import { RoleOption } from '@/components/OrganizationRolesSelect';
import { SubscriptionDataContext } from '@/contexts/SubscriptionDataProvider';
import { TenantsContext } from '@/contexts/TenantsProvider';
import ActionMenu, { ActionMenuItem } from '@/ds-components/ActionMenu';
import Button from '@/ds-components/Button';
Expand Down Expand Up @@ -56,7 +57,7 @@ function Invitations() {
const {
access: { canInviteMember, canRemoveMember },
} = useCurrentTenantScopes();

const { mutateSubscriptionQuotaAndUsages } = useContext(SubscriptionDataContext);
const { data, error, isLoading, mutate } = useSWR<TenantInvitationResponse[], RequestError>(
`api/tenants/${currentTenantId}/invitations`,
async () =>
Expand All @@ -80,6 +81,7 @@ function Invitations() {
params: { tenantId: currentTenantId, invitationId },
body: { status: OrganizationInvitationStatus.Revoked },
});
mutateSubscriptionQuotaAndUsages();
void mutate();
toast.success(t('messages.invitation_revoked'));
};
Expand All @@ -97,6 +99,7 @@ function Invitations() {
await cloudApi.delete(`/api/tenants/:tenantId/invitations/:invitationId`, {
params: { tenantId: currentTenantId, invitationId },
});
mutateSubscriptionQuotaAndUsages();
void mutate();
toast.success(t('messages.invitation_deleted'));
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function InviteMemberModal({ isOpen, onClose }: Props) {
currentSubscription: { planId, isAddOnAvailable },
currentSubscriptionQuota,
currentSubscriptionUsage: { tenantMembersLimit },
mutateSubscriptionQuotaAndUsages,
} = useContext(SubscriptionDataContext);
const {
data: { tenantMembersUpsellNoticeAcknowledged },
Expand Down Expand Up @@ -109,6 +110,7 @@ function InviteMemberModal({ isOpen, onClose }: Props) {
params: { tenantId: currentTenantId },
body: { invitee: emails.map(({ value }) => value), roleName: role },
});
mutateSubscriptionQuotaAndUsages();
toast.success(t('tenant_members.messages.invitation_sent'));
onClose(true);
} finally {
Expand Down
Loading