diff --git a/src/actions/delete-invitation.ts b/src/actions/delete-invitation.ts index 347a1f9..17d6162 100644 --- a/src/actions/delete-invitation.ts +++ b/src/actions/delete-invitation.ts @@ -2,7 +2,7 @@ import db from '@/lib/db'; import * as Sentry from '@sentry/nextjs'; import { checkAuthAction, getErrorMessage } from './utils'; -import { revalidateTag } from 'next/cache'; +import { revalidatePath } from 'next/cache'; interface DeleteInvitationResult { error?: { @@ -32,6 +32,7 @@ export default async function deleteInvitation( }, }); + revalidatePath('/teams/[teamSlug]/settings'); return { data: { invitationId } }; } catch (err: any) { Sentry.captureException(err); diff --git a/src/actions/generate-api-key.ts b/src/actions/generate-api-key.ts index d43a4c3..c6838c6 100644 --- a/src/actions/generate-api-key.ts +++ b/src/actions/generate-api-key.ts @@ -2,7 +2,6 @@ import db from '@/lib/db'; import * as Sentry from '@sentry/nextjs'; import jwt from 'jsonwebtoken'; -import { revalidateTag } from 'next/cache'; interface APIKeyGenerationResult { error?: { diff --git a/src/actions/update-team-info.ts b/src/actions/update-team-info.ts index 6954cbd..59319c1 100644 --- a/src/actions/update-team-info.ts +++ b/src/actions/update-team-info.ts @@ -1,7 +1,6 @@ 'use server'; import db from '@/lib/db'; import * as Sentry from '@sentry/nextjs'; -import { revalidateTag } from 'next/cache'; import { checkAuthAction, checkTeamAction, getErrorMessage } from './utils'; import { Team } from '@prisma/client'; diff --git a/src/components/teams/settings-tabs/invitations/InvitationList.tsx b/src/components/teams/settings-tabs/invitations/InvitationList.tsx index 5fc3186..4909654 100644 --- a/src/components/teams/settings-tabs/invitations/InvitationList.tsx +++ b/src/components/teams/settings-tabs/invitations/InvitationList.tsx @@ -1,7 +1,7 @@ 'use client'; import useCustomToast from '@/hooks/useCustomToast'; -import { useTransition, useOptimistic } from 'react'; +import { useTransition } from 'react'; import { TeamInvitation } from '@/lib/queries'; import message from '@/messages/en'; import InvitationItem from './InvitationItem'; @@ -14,15 +14,9 @@ type Props = { const InvitationList = ({ invitations }: Props) => { const { successToast, errorToast } = useCustomToast(); const [isPending, startTransition] = useTransition(); - const [optiInvitations, removeOptiInvitation] = useOptimistic( - invitations || [], - (state, deleteId: string) => - [...state].filter((invitation) => invitation?.id !== deleteId) - ); const handleDeleteInvitation = async (invitation: TeamInvitation) => { startTransition(async () => { - removeOptiInvitation(invitation?.id); const { error } = await deleteInvitation(invitation.id); if (error) { errorToast(error.message); @@ -35,7 +29,7 @@ const InvitationList = ({ invitations }: Props) => { return (
- {optiInvitations.map((invitation: TeamInvitation) => ( + {invitations.map((invitation: TeamInvitation) => (