The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update group-settings.tsx
Kiran K866f88bd0a5d
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/group-settings.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/group-settings.tsxindex ab4dffe2ee..1a6f13df33 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/group-settings.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/group-settings.tsx@@ -17,16 +17,22 @@ import { z } from "zod";type FormData = z.input<typeof updateGroupSchema>;export function GroupSettings() {- const { group, loading } = useGroup();+ const { group, loading, mutateGroup } = useGroup();if (!group || loading) {return <LoadingSpinner />;}- return <GroupSettingsForm group={group} />;+ return <GroupSettingsForm group={group} mutateGroup={mutateGroup} />;}-function GroupSettingsForm({ group }: { group: GroupProps }) {+function GroupSettingsForm({+ group,+ mutateGroup,+}: {+ group: GroupProps;+ mutateGroup: () => void;+}) {const router = useRouter();const { program } = useProgram();const { slug } = useParams<{ slug: string }>();@@ -55,13 +61,15 @@ function GroupSettingsForm({ group }: { group: GroupProps }) {await updateGroup(`/api/groups/${group.id}`, {method: "PATCH",body: data,- onSuccess: () => {+ onSuccess: async () => {toast.success("Group updated successfully!");// If slug changed, redirect to new URLif (data.slug !== group.slug) {router.push(`/${slug}/program/groups/${data.slug}`);}++ await mutateGroup();},});};