The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update archive-domain-modal.tsx
Steven Tey1459af4a6598
diff --git a/apps/web/ui/modals/archive-domain-modal.tsx b/apps/web/ui/modals/archive-domain-modal.tsxindex cb14c4d119..542b43d1a7 100644--- a/apps/web/ui/modals/archive-domain-modal.tsx+++ b/apps/web/ui/modals/archive-domain-modal.tsx@@ -55,15 +55,19 @@ function ArchiveDomainModal({archive: !props.archived,workspaceId,});- setArchiving(false);if (!res.ok) {const { error } = await res.json();+ setArchiving(false);toast.error(error.message);return;}- mutate(`/api/domains?workspaceId=${workspaceId}`);+ await mutate(+ (key) =>+ typeof key === "string" &&+ key.startsWith(`/api/domains?workspaceId=${workspaceId}`),+ );setShowArchiveDomainModal(false);toastWithUndo({id: "domain-archive-undo-toast",@@ -83,8 +87,12 @@ function ArchiveDomainModal({{loading: "Undo in progress...",error: "Failed to roll back changes. An error occurred.",- success: () => {- mutate(`/api/domains?workspaceId=${workspaceId}`);+ success: async () => {+ await mutate(+ (key) =>+ typeof key === "string" &&+ key.startsWith(`/api/domains?workspaceId=${workspaceId}`),+ );return "Undo successful! Changes reverted.";},},@@ -103,8 +111,15 @@ function ArchiveDomainModal({</h3><p className="text-sm text-gray-500">{props.archived- ? "By unarchiving this domain, it will show up in the link creation modal again."- : "Archived domains will still work, but they won't show up in the link creation modal."}+ ? "By unarchiving this domain, it will show up in the link builder. "+ : "Archiving a domain will hide it from the link builder. "}+ <a+ href="https://dub.co/help/article/archiving-domains"+ target="_blank"+ className="text-sm text-gray-500 underline"+ >+ Learn more+ </a></p></div>