From 7256dbf84fe79f76f78f54b6453037c269b789bb Mon Sep 17 00:00:00 2001 From: Leo Giovanetti Date: Wed, 28 Sep 2022 19:07:55 -0300 Subject: [PATCH] Fix updating slug (#4747) --- apps/web/pages/v2/event-types/[type]/index.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/web/pages/v2/event-types/[type]/index.tsx b/apps/web/pages/v2/event-types/[type]/index.tsx index 54c5a74339..44ea15ee76 100644 --- a/apps/web/pages/v2/event-types/[type]/index.tsx +++ b/apps/web/pages/v2/event-types/[type]/index.tsx @@ -96,7 +96,8 @@ export type EventTypeSetupInfered = inferSSRProps; const EventTypePage = (props: inferSSRProps) => { const { t } = useLocale(); - const { eventType, locationOptions, team, teamMembers } = props; + const { eventType: dbEventType, locationOptions, team, teamMembers } = props; + const [eventType, setEventType] = useState(dbEventType); const animationParentRef = useRef(null); const router = useRouter(); const { tabName } = querySchema.parse(router.query); @@ -106,7 +107,8 @@ const EventTypePage = (props: inferSSRProps) => { }, [animationParentRef]); const updateMutation = trpc.useMutation("viewer.eventTypes.update", { - onSuccess: async ({ eventType }) => { + onSuccess: async ({ eventType: newEventType }) => { + setEventType({ ...eventType, slug: newEventType.slug }); showToast( t("event_type_updated_successfully", { eventTypeTitle: eventType.title,