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.

mutate links when edit tags

Steven Tey7e5b1edc368c
diff --git a/apps/web/ui/modals/add-edit-tag-modal.tsx b/apps/web/ui/modals/add-edit-tag-modal.tsx
index 91676c2119..847e96d568 100644
--- a/apps/web/ui/modals/add-edit-tag-modal.tsx
+++ b/apps/web/ui/modals/add-edit-tag-modal.tsx
@@ -62,7 +62,7 @@ function AddEditTagModal({
const endpoint = useMemo(
() =>
- props
+ id
? {
method: "PUT",
url: `/api/tags/${id}?projectSlug=${projectSlug}`,
@@ -117,7 +117,17 @@ function AddEditTagModal({
}).then(async (res) => {
if (res.status === 200) {
va.track(props ? "Edited Tag" : "Created Tag");
- await mutate(`/api/tags?projectSlug=${projectSlug}`);
+ await Promise.all([
+ mutate(`/api/tags?projectSlug=${projectSlug}`),
+ props
+ ? mutate(
+ (key) =>
+ typeof key === "string" && key.startsWith("/api/links"),
+ undefined,
+ { revalidate: true },
+ )
+ : null,
+ ]);
toast.success(endpoint.successMessage);
setShowAddEditTagModal(false);
} else {