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 /api/tags

Steven Tey583d3a66d54a
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/tags/tag-card.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/tags/tag-card.tsx
index 491e5c0a9d..fd0f001d8d 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/tags/tag-card.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/tags/tag-card.tsx
@@ -66,7 +66,11 @@ export function TagCard({
.then(async (res) => {
if (res.ok) {
await Promise.all([
- mutate(`/api/tags?workspaceId=${id}`),
+ mutate(
+ (key) => typeof key === "string" && key.startsWith("/api/tags"),
+ undefined,
+ { revalidate: true },
+ ),
mutate(
(key) => typeof key === "string" && key.startsWith("/api/links"),
undefined,
diff --git a/apps/web/ui/modals/add-edit-tag-modal.tsx b/apps/web/ui/modals/add-edit-tag-modal.tsx
index 099d5f3704..7f1726caa9 100644
--- a/apps/web/ui/modals/add-edit-tag-modal.tsx
+++ b/apps/web/ui/modals/add-edit-tag-modal.tsx
@@ -123,15 +123,18 @@ function AddEditTagModal({
tag_color: data.color,
});
await Promise.all([
- mutate(`/api/tags?workspaceId=${workspaceId}`),
- props
- ? mutate(
- (key) =>
- typeof key === "string" && key.startsWith("/api/links"),
- undefined,
- { revalidate: true },
- )
- : null,
+ mutate(
+ (key) =>
+ typeof key === "string" && key.startsWith("/api/tags"),
+ undefined,
+ { revalidate: true },
+ ),
+ mutate(
+ (key) =>
+ typeof key === "string" && key.startsWith("/api/links"),
+ undefined,
+ { revalidate: true },
+ ),
]);
toast.success(endpoint.successMessage);
setShowAddEditTagModal(false);