fix: event type invalidation (#12077)

pull/11958/merge
Aldrin 2023-10-25 22:59:41 +05:30 committed by GitHub
parent 9364055283
commit 0fb75b715d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -79,6 +79,7 @@ export default function CreateEventTypeDialog({
membershipRole: MembershipRole | null | undefined; membershipRole: MembershipRole | null | undefined;
}[]; }[];
}) { }) {
const utils = trpc.useContext();
const { t } = useLocale(); const { t } = useLocale();
const router = useRouter(); const router = useRouter();
const [firstRender, setFirstRender] = useState(true); const [firstRender, setFirstRender] = useState(true);
@ -116,6 +117,7 @@ export default function CreateEventTypeDialog({
const createMutation = trpc.viewer.eventTypes.create.useMutation({ const createMutation = trpc.viewer.eventTypes.create.useMutation({
onSuccess: async ({ eventType }) => { onSuccess: async ({ eventType }) => {
await utils.viewer.eventTypes.getByViewer.invalidate();
await router.replace(`/event-types/${eventType.id}`); await router.replace(`/event-types/${eventType.id}`);
showToast( showToast(
t("event_type_created_successfully", { t("event_type_created_successfully", {