Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

fix mutate

Steven Tey27a681c2145f
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/links/group-link-settings.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/links/group-link-settings.tsx
index a8b174b9be..d54694da22 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/links/group-link-settings.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/links/group-link-settings.tsx
@@ -163,8 +163,6 @@ function GroupLinkSettingsForm({ group }: { group: GroupProps }) {
const data = await response.json();
utmTemplateId = data.id;
}
-
- await mutatePrefix("/api/utm");
}
// Update the group with UTM template and link structure
@@ -179,12 +177,11 @@ function GroupLinkSettingsForm({ group }: { group: GroupProps }) {
linkStructure,
utmTemplateId,
},
- onSuccess: async () => {
- await mutatePrefix(["/api/groups", "/api/utm"]);
- toast.success("Settings saved successfully!");
- },
});
}
+
+ await mutatePrefix(["/api/groups", "/api/utm"]);
+ toast.success("Successfully updated link settings!");
};
return (
diff --git a/apps/web/lib/swr/use-group.ts b/apps/web/lib/swr/use-group.ts
index 7279e79659..8b7066a171 100644
--- a/apps/web/lib/swr/use-group.ts
+++ b/apps/web/lib/swr/use-group.ts
@@ -19,6 +19,9 @@ export default function useGroup({ slug: slugProp }: { slug?: string } = {}) {
? `/api/groups/${groupSlug}?workspaceId=${workspaceId}`
: undefined,
fetcher,
+ {
+ keepPreviousData: true,
+ },
);
return {