The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
await mutate
Steven Tey67ab66c8dae7
diff --git a/README.md b/README.mdindex c4fe73bf0b..4e1bb5a449 100644--- a/README.md+++ b/README.md@@ -45,9 +45,9 @@ To develop Dub locally, you will need to clone this repository and set up all thOnce that's done, you can use the following commands to run the app locally:```-bun i-bun run build-bun dev+yarn+yarn build+yarn dev```We're planning to add a proper, well-documented self-hosting guide for Dub soon – stay tuned!diff --git a/app/ui/button.tsx b/app/ui/button.tsxindex 030ab84949..0d7e4b23b6 100644--- a/app/ui/button.tsx+++ b/app/ui/button.tsx@@ -5,25 +5,22 @@ import Tooltip from "#/ui/tooltip";import { cn } from "#/lib/utils";import { ReactNode } from "react";+interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {+ text: string;+ variant?: "primary" | "secondary" | "success" | "danger";+ loading?: boolean;+ icon?: ReactNode;+ disabledTooltip?: string | ReactNode;+}+export default function Button({text,variant = "primary",- className,- onClick,- disabled,loading,icon,disabledTooltip,-}: {- text: string;- variant?: "primary" | "secondary" | "success" | "danger";- className?: string;- onClick?: any;- disabled?: boolean;- loading?: boolean;- icon?: ReactNode;- disabledTooltip?: string | ReactNode;-}) {+ ...props+}: ButtonProps) {if (disabledTooltip) {return (<Tooltip content={disabledTooltip} fullWidth>@@ -36,10 +33,10 @@ export default function Button({return (<button// if onClick is passed, it's a "button" type, otherwise it's being used in a form, hence "submit"- type={onClick ? "button" : "submit"}+ type={props.onClick ? "button" : "submit"}className={cn("flex h-10 w-full items-center justify-center space-x-2 rounded-md border px-4 text-sm transition-all focus:outline-none",- disabled || loading+ props.disabled || loading? "cursor-not-allowed border-gray-200 bg-gray-100 text-gray-400": {"border-black bg-black text-white hover:bg-white hover:text-black":@@ -51,10 +48,10 @@ export default function Button({"border-red-500 bg-red-500 text-white hover:bg-white hover:text-red-500":variant === "danger",},- className,+ props.className,)}- {...(onClick ? { onClick } : {})}- disabled={disabled || loading}+ disabled={props.disabled || loading}+ {...props}>{loading ? <LoadingSpinner /> : icon ? icon : null}<p>{text}</p>diff --git a/app/ui/modals/add-edit-link-modal/index.tsx b/app/ui/modals/add-edit-link-modal/index.tsxindex f221ef8d8a..371dfe5338 100644--- a/app/ui/modals/add-edit-link-modal/index.tsx+++ b/app/ui/modals/add-edit-link-modal/index.tsx@@ -309,25 +309,26 @@ function AddEditLinkModal({},body: JSON.stringify(data),}).then(async (res) => {- setSaving(false);if (res.status === 200) {// track link creation eventendpoint.method === "POST" &&va.track("Created Link", {type: slug ? "Custom Domain" : "Default Domain",});- mutate(- `/api/links${- searchParams ? `?${searchParams.toString()}` : ""- }`,- );- mutate(- (key) =>- typeof key === "string" &&- key.startsWith(`/api/links/_count`),- undefined,- { revalidate: true },- );+ await Promise.all([+ mutate(+ `/api/links${+ searchParams ? `?${searchParams.toString()}` : ""+ }`,+ ),+ mutate(+ (key) =>+ typeof key === "string" &&+ key.startsWith(`/api/links/_count`),+ undefined,+ { revalidate: true },+ ),+ ]);// for welcome page, redirect to links page after adding a linkif (pathname === "/welcome") {router.push("/links");@@ -361,6 +362,7 @@ function AddEditLinkModal({toast.error(res.statusText);}}+ setSaving(false);});}}className="grid gap-6 bg-gray-50 pt-8"diff --git a/app/ui/modals/add-edit-link-modal/tags-section.tsx b/app/ui/modals/add-edit-link-modal/tags-section.tsxindex 3476f26f7f..4dbe257cab 100644--- a/app/ui/modals/add-edit-link-modal/tags-section.tsx+++ b/app/ui/modals/add-edit-link-modal/tags-section.tsx@@ -49,7 +49,7 @@ export default function TagsSection({body: JSON.stringify({ tag }),}).then(async (res) => {if (res.ok) {- mutate(`/api/projects/${slug}/tags`);+ await mutate(`/api/projects/${slug}/tags`);const newTag = await res.json();setData({ ...data, tagId: newTag.id });toast.success(`Successfully created tag!`);diff --git a/app/ui/stats/toggle.tsx b/app/ui/stats/toggle.tsxindex df1897c7fd..3afd7b5b72 100644--- a/app/ui/stats/toggle.tsx+++ b/app/ui/stats/toggle.tsx@@ -151,13 +151,11 @@ const SharePopover = () => {}),});if (res.status === 200) {- mutate(`${endpoint}${queryString}`);+ await mutate(`${endpoint}${queryString}`);!publicStats &&navigator.clipboard.writeText(`https://${domain}/stats/${encodeURIComponent(key)}`,);- // artificial delay to sync toast with the switch change- await new Promise((r) => setTimeout(r, 200));}setUpdating(false);resolve();diff --git a/components/app/links/link-card.tsx b/components/app/links/link-card.tsxindex ff86c03abf..ec03d129f1 100644--- a/components/app/links/link-card.tsx+++ b/components/app/links/link-card.tsx@@ -488,7 +488,7 @@ export default function LinkCard({className="group flex w-full items-center justify-between rounded-md p-2 text-left text-sm font-medium text-gray-500 transition-all duration-75 hover:bg-gray-100"><IconMenu- text="Archive"+ text={archived ? "Unarchive" : "Archive"}icon={<Archive className="h-4 w-4" />}/><kbd className="hidden rounded bg-gray-100 px-2 py-0.5 text-xs font-light text-gray-500 transition-all duration-75 group-hover:bg-gray-200 sm:inline-block">diff --git a/components/app/links/link-filters.tsx b/components/app/links/link-filters.tsxindex 6dbcda8347..d0e12d0ad7 100644--- a/components/app/links/link-filters.tsx+++ b/components/app/links/link-filters.tsx@@ -395,11 +395,11 @@ const TagPopover = ({ tag, count }: { tag: TagProps; count: number }) => {"Content-Type": "application/json",},body: JSON.stringify(data),- }).then((res) => {+ }).then(async (res) => {setProcessing(false);if (res.ok) {+ await mutate(`/api/projects/${slug}/tags`);toast.success("Tag updated");- mutate(`/api/projects/${slug}/tags`);} else {toast.error("Something went wrong");}@@ -410,14 +410,14 @@ const TagPopover = ({ tag, count }: { tag: TagProps; count: number }) => {setProcessing(true);fetch(`/api/projects/${slug}/tags/${tag.id}`, {method: "DELETE",- }).then((res) => {- setProcessing(false);+ }).then(async (res) => {if (res.ok) {+ await mutate(`/api/projects/${slug}/tags`);toast.success("Tag deleted");- mutate(`/api/projects/${slug}/tags`);} else {toast.error("Something went wrong");}+ setProcessing(false);});};diff --git a/components/app/modals/accept-invite-modal.tsx b/components/app/modals/accept-invite-modal.tsxindex c9a1d48e0b..d61a51971c 100644--- a/components/app/modals/accept-invite-modal.tsx+++ b/components/app/modals/accept-invite-modal.tsx@@ -52,18 +52,18 @@ function AcceptInviteModal({fetch(`/api/projects/${slug}/invites/accept`, {method: "POST",headers: { "Content-Type": "application/json" },- }).then(() => {- toast.success("You now are a part of this project!");+ }).then(async () => {va.track("User accepted project invite", {project: slug,});- mutate(+ await mutate((key) =>typeof key === "string" &&key.startsWith(`/api/projects`),undefined,{ revalidate: true },);+ toast.success("You now are a part of this project!");});}}disabled={accepting}diff --git a/components/app/modals/add-edit-domain-modal.tsx b/components/app/modals/add-edit-domain-modal.tsxindex 7e0fdb1ee0..c12e643a3b 100644--- a/components/app/modals/add-edit-domain-modal.tsx+++ b/components/app/modals/add-edit-domain-modal.tsx@@ -115,12 +115,14 @@ function AddEditDomainModal({}).then(async (res) => {setDeleting(false);if (res.status === 200) {- mutate(`/api/projects/${slug}/domains`);- mutate(- (key) => typeof key === "string" && key.startsWith(`/api/links`),- undefined,- { revalidate: true },- );+ await Promise.all([+ mutate(`/api/projects/${slug}/domains`),+ mutate(+ (key) => typeof key === "string" && key.startsWith(`/api/links`),+ undefined,+ { revalidate: true },+ ),+ ]);setShowAddEditDomainModal(false);toast.success("Successfully deleted domain!");} else {@@ -162,7 +164,7 @@ function AddEditDomainModal({}).then(async (res) => {setSaving(false);if (res.status === 200) {- mutate(`/api/projects/${slug}/domains`);+ await mutate(`/api/projects/${slug}/domains`);setShowAddEditDomainModal(false);toast.success(endpoint.successMessage);if (!props) {diff --git a/components/app/modals/add-edit-link-modal/index.tsx b/components/app/modals/add-edit-link-modal/index.tsxindex 306a25b307..0845dd55da 100644--- a/components/app/modals/add-edit-link-modal/index.tsx+++ b/components/app/modals/add-edit-link-modal/index.tsx@@ -333,40 +333,37 @@ function AddEditLinkModal({},body: JSON.stringify(rest),}).then(async (res) => {- setSaving(false);if (res.status === 200) {// track link creation eventendpoint.method === "POST" &&va.track("Created Link", {type: slug ? "Custom Domain" : "Default Domain",});- mutate(`/api/links${getQueryString(router)}`);- mutate(- (key) =>- typeof key === "string" &&- key.startsWith(`/api/links/_count`),- undefined,- { revalidate: true },- );+ await Promise.all([+ mutate(`/api/links${getQueryString(router)}`),+ mutate(+ (key) =>+ typeof key === "string" &&+ key.startsWith(`/api/links/_count`),+ undefined,+ { revalidate: true },+ ),+ ]);// for welcome page, redirect to links page after adding a linkif (router.pathname === "/app/welcome") {- router.push("/links").then(() => {- setShowAddEditLinkModal(false);- });+ await router.push("/links");+ setShowAddEditLinkModal(false);}// copy shortlink to clipboard when adding a new linkif (!props) {- navigator.clipboard- .writeText(- linkConstructor({- // remove leading and trailing slashes- key: data.key.replace(/^\/+|\/+$/g, ""),- domain,- }),- )- .then(() => {- toast.success("Copied shortlink to clipboard!");- });+ await navigator.clipboard.writeText(+ linkConstructor({+ // remove leading and trailing slashes+ key: data.key.replace(/^\/+|\/+$/g, ""),+ domain,+ }),+ );+ toast.success("Copied shortlink to clipboard!");} else {toast.success("Successfully updated shortlink!");}@@ -384,6 +381,7 @@ function AddEditLinkModal({toast.error(res.statusText);}}+ setSaving(false);});}}className="grid gap-6 bg-gray-50 pt-8"diff --git a/components/app/modals/add-project-modal.tsx b/components/app/modals/add-project-modal.tsxindex 6585e52b39..e848e1fada 100644--- a/components/app/modals/add-project-modal.tsx+++ b/components/app/modals/add-project-modal.tsx@@ -117,7 +117,7 @@ function AddProjectModalHelper({if (res.status === 200) {// track project creation eventva.track("Created Project");- mutate("/api/projects");+ await mutate("/api/projects");if (welcomeFlow) {router.push({pathname: "/welcome",@@ -127,7 +127,7 @@ function AddProjectModalHelper({},});} else {- router.push(`/${slug}`);+ await router.push(`/${slug}`);toast.success("Successfully created project!");setShowAddProjectModal(false);}diff --git a/components/app/modals/archive-link-modal.tsx b/components/app/modals/archive-link-modal.tsxindex 21d8904646..e0268fb875 100644--- a/components/app/modals/archive-link-modal.tsx+++ b/components/app/modals/archive-link-modal.tsx@@ -80,16 +80,17 @@ function ArchiveLinkModal({},},).then(async (res) => {- setArchiving(false);if (res.status === 200) {- mutate(`/api/links${getQueryString(router)}`);- mutate(- (key) =>- typeof key === "string" &&- key.startsWith(`/api/links/_count`),- undefined,- { revalidate: true },- );+ await Promise.all([+ mutate(`/api/links${getQueryString(router)}`),+ mutate(+ (key) =>+ typeof key === "string" &&+ key.startsWith(`/api/links/_count`),+ undefined,+ { revalidate: true },+ ),+ ]);setShowArchiveLinkModal(false);toast.success(`Successfully ${archived ? "archived" : "unarchived"} link!`,@@ -97,8 +98,10 @@ function ArchiveLinkModal({} else {toast.error(res.statusText);}+ setArchiving(false);});}}+ autoFocusloading={archiving}text={`Confirm ${archived ? "archive" : "unarchive"}`}/>diff --git a/components/app/modals/delete-link-modal.tsx b/components/app/modals/delete-link-modal.tsxindex d5549dfcb9..c9fa29e355 100644--- a/components/app/modals/delete-link-modal.tsx+++ b/components/app/modals/delete-link-modal.tsx@@ -74,22 +74,24 @@ function DeleteLinkModal({},},).then(async (res) => {- setDeleting(false);if (res.status === 200) {- mutate(`/api/links${getQueryString(router)}`);- mutate(- (key) =>- typeof key === "string" &&- key.startsWith(`/api/links/_count`),- undefined,- { revalidate: true },- );+ await Promise.all([+ mutate(`/api/links${getQueryString(router)}`),+ mutate(+ (key) =>+ typeof key === "string" &&+ key.startsWith(`/api/links/_count`),+ undefined,+ { revalidate: true },+ ),+ ]);setShowDeleteLinkModal(false);toast.success("Successfully deleted shortlink!");} else {const { error } = await res.json();toast.error(error);}+ setDeleting(false);});}}className="flex flex-col space-y-6 bg-gray-50 px-4 py-8 text-left sm:px-16"diff --git a/components/app/modals/delete-project-modal.tsx b/components/app/modals/delete-project-modal.tsxindex 205f2ad5e8..216c1321bf 100644--- a/components/app/modals/delete-project-modal.tsx+++ b/components/app/modals/delete-project-modal.tsx@@ -36,20 +36,15 @@ function DeleteProjectModal({"Content-Type": "application/json",},}).then(async (res) => {- setDeleting(false);if (res.ok) {- router.push("/");- mutate("/api/projects");- // delay to allow for the route change to complete- await new Promise(() =>- setTimeout(() => {- resolve(null);- }, 200),- );+ await mutate("/api/projects");+ await router.push("/");+ resolve(null);} else {const error = await res.text();reject(error);}+ setDeleting(false);});});}diff --git a/components/app/modals/edit-role-modal.tsx b/components/app/modals/edit-role-modal.tsxindex c37795dbf9..755ce97744 100644--- a/components/app/modals/edit-role-modal.tsx+++ b/components/app/modals/edit-role-modal.tsx@@ -78,17 +78,17 @@ function EditRoleModal({role,}),}).then(async (res) => {- setEditing(false);if (res.status === 200) {+ await mutate(`/api/projects/${slug}/users`);+ setShowEditRoleModal(false);toast.success(`Successfully changed ${name || email}'s role to ${role}.`,);- mutate(`/api/projects/${slug}/users`);- setShowEditRoleModal(false);} else {const error = await res.text();toast.error(error);}+ setEditing(false);});}}/>diff --git a/components/app/modals/import-bitly-modal.tsx b/components/app/modals/import-bitly-modal.tsxindex 1d7d2a8c0d..25e2621062 100644--- a/components/app/modals/import-bitly-modal.tsx+++ b/components/app/modals/import-bitly-modal.tsx@@ -133,15 +133,15 @@ function ImportBitlyModal({selectedDomains,selectedGroupTags,}),- }).then((res) => {- setImporting(false);+ }).then(async (res) => {if (res.ok) {+ await mutate(`/api/projects/${slug}/domains`);closeModal(router);- mutate(`/api/projects/${slug}/domains`);setPollLinks(true);} else {throw new Error();}+ setImporting(false);}),{loading: "Adding links to import queue...",diff --git a/components/app/modals/import-short-modal.tsx b/components/app/modals/import-short-modal.tsxindex 33b34ebd9a..3950bcfcdc 100644--- a/components/app/modals/import-short-modal.tsx+++ b/components/app/modals/import-short-modal.tsx@@ -124,15 +124,15 @@ function ImportShortModal({body: JSON.stringify({selectedDomains,}),- }).then((res) => {- setImporting(false);+ }).then(async (res) => {if (res.ok) {+ await mutate(`/api/projects/${slug}/domains`);closeModal(router);- mutate(`/api/projects/${slug}/domains`);setPollLinks(true);} else {throw new Error();}+ setImporting(false);}),{loading: "Adding links to import queue...",@@ -199,9 +199,9 @@ function ImportShortModal({body: JSON.stringify({apiKey: e.currentTarget.apiKey.value,}),- }).then((res) => {+ }).then(async (res) => {if (res.ok) {- mutate(`/api/projects/${slug}/import/short`);+ await mutate(`/api/projects/${slug}/import/short`);toast.success("Successfully added API key");} else {toast.error("Error adding API key");diff --git a/components/app/modals/invite-teammate-modal.tsx b/components/app/modals/invite-teammate-modal.tsxindex 434c9ea7bd..8dcd8478f4 100644--- a/components/app/modals/invite-teammate-modal.tsx+++ b/components/app/modals/invite-teammate-modal.tsx@@ -60,18 +60,18 @@ function InviteTeammateModal({headers: { "Content-Type": "application/json" },body: JSON.stringify({ email }),}).then(async (res) => {- setInviting(false);if (res.status === 200) {+ await mutate(`/api/projects/${slug}/invites`);toast.success("Invitation sent!");va.track("User invited teammate", {project: slug,});- mutate(`/api/projects/${slug}/invites`);setShowInviteTeammateModal(false);} else {const error = await res.text();toast.error(error);}+ setInviting(false);});}}className="flex flex-col space-y-4 bg-gray-50 px-4 py-8 text-left sm:px-16"diff --git a/components/app/modals/remove-saml-modal.tsx b/components/app/modals/remove-saml-modal.tsxindex e66b598b22..bbc7d3a1c3 100644--- a/components/app/modals/remove-saml-modal.tsx+++ b/components/app/modals/remove-saml-modal.tsx@@ -83,15 +83,14 @@ function RemoveSAMLModal({method: "DELETE",}).then(async (res) => {if (res.ok) {- toast.success("SAML removed successfully");- mutate();- setRemoving(false);+ await mutate();setShowRemoveSAMLModal(false);+ toast.success("SAML removed successfully");} else {const error = await res.text();toast.error(error);- setRemoving(false);}+ setRemoving(false);});}}/>diff --git a/components/app/modals/remove-scim-modal.tsx b/components/app/modals/remove-scim-modal.tsxindex caf3eeddac..74c2e08828 100644--- a/components/app/modals/remove-scim-modal.tsx+++ b/components/app/modals/remove-scim-modal.tsx@@ -88,15 +88,14 @@ function RemoveSCIMModal({method: "DELETE",}).then(async (res) => {if (res.ok) {- toast.success("SCIM directory removed successfully");- mutate();- setRemoving(false);+ await mutate();setShowRemoveSCIMModal(false);+ toast.success("SCIM directory removed successfully");} else {const error = await res.text();toast.error(error);- setRemoving(false);}+ setRemoving(false);});}}/>diff --git a/components/app/modals/remove-teammate-modal.tsx b/components/app/modals/remove-teammate-modal.tsxindex 362bfa1d4d..5a0539836b 100644--- a/components/app/modals/remove-teammate-modal.tsx+++ b/components/app/modals/remove-teammate-modal.tsx@@ -121,8 +121,16 @@ function RemoveTeammateModal({headers: { "Content-Type": "application/json" },},).then(async (res) => {- setRemoving(false);if (res.status === 200) {+ await mutate(+ `/api/projects/${slug}/${invite ? "invites" : "users"}`,+ );+ if (session?.user?.email === email) {+ await mutate("/api/projects");+ await router.push("/");+ } else {+ setShowRemoveTeammateModal(false);+ }toast.success(session?.user?.email === email? "You have left the project!"@@ -130,16 +138,11 @@ function RemoveTeammateModal({? "Successfully revoked invitation!": "Successfully removed teammate!",);- mutate(`/api/projects/${slug}/${invite ? "invites" : "users"}`);- setShowRemoveTeammateModal(false);- if (session?.user?.email === email) {- mutate("/api/projects");- router.push("/");- }} else {const error = await res.text();toast.error(error);}+ setRemoving(false);});}}/>diff --git a/components/app/modals/saml-modal.tsx b/components/app/modals/saml-modal.tsxindex 58f61d58cf..7167c3d1ef 100644--- a/components/app/modals/saml-modal.tsx+++ b/components/app/modals/saml-modal.tsx@@ -67,9 +67,9 @@ function SAMLModal({}),}).then(async (res) => {if (res.ok) {- mutate();- toast.success("Successfully configured SAML");+ await mutate();setShowSAMLModal(false);+ toast.success("Successfully configured SAML");} else {const err = await res.text();toast.error(err);diff --git a/components/app/modals/scim-modal.tsx b/components/app/modals/scim-modal.tsxindex b21d7d78b8..e18dffd8ac 100644--- a/components/app/modals/scim-modal.tsx+++ b/components/app/modals/scim-modal.tsx@@ -88,7 +88,7 @@ function SCIMModal({}),}).then(async (res) => {if (res.ok) {- mutate();+ await mutate();toast.success("Successfully configured SCIM");} else {const err = await res.text();diff --git a/components/app/projects/upload-logo.tsx b/components/app/projects/upload-logo.tsxindex 3258a16196..3fb5cb8609 100644--- a/components/app/projects/upload-logo.tsx+++ b/components/app/projects/upload-logo.tsx@@ -50,16 +50,18 @@ export default function UploadLogo() {},body: JSON.stringify({ image }),}).then(async (res) => {- setUploading(false);if (res.status === 200) {- mutate(`/api/projects`);- mutate(`/api/projects/${slug}`);+ await Promise.all([+ mutate(`/api/projects`),+ mutate(`/api/projects/${slug}`),+ ]);toast.success("Succesfully uploaded project logo!");} else if (res.status === 413) {toast.error("File size too big (max 2MB)");} else {toast.error("Something went wrong");}+ setUploading(false);});}}className="rounded-lg border border-gray-200 bg-white"diff --git a/components/stats/toggle.tsx b/components/stats/toggle.tsxindex e55127e0bf..f97b761dff 100644--- a/components/stats/toggle.tsx+++ b/components/stats/toggle.tsx@@ -176,13 +176,11 @@ const SharePopover = () => {}),});if (res.status === 200) {- mutate(`${endpoint}${queryString}`);+ await mutate(`${endpoint}${queryString}`);!publicStats &&navigator.clipboard.writeText(`https://${domain}/stats/${encodeURIComponent(key)}`,);- // artificial delay to sync toast with the switch change- await new Promise((r) => setTimeout(r, 200));}setUpdating(false);resolve();diff --git a/lib/swr/use-links.ts b/lib/swr/use-links.tsindex 8217218f97..1dc1269b58 100644--- a/lib/swr/use-links.ts+++ b/lib/swr/use-links.ts@@ -12,9 +12,7 @@ export default function useLinks() {user: UserProps;})[]>(router.isReady && `/api/links${getQueryString(router)}`, fetcher, {- // disable this because it keeps refreshing the state of the modal when its open- revalidateOnFocus: false,- dedupingInterval: 30000,+ dedupingInterval: 20000,});return {diff --git a/lib/swr/use-project.ts b/lib/swr/use-project.tsindex 82cc34170b..468b7320a2 100644--- a/lib/swr/use-project.ts+++ b/lib/swr/use-project.ts@@ -3,6 +3,7 @@ import useSWR from "swr";import { ProjectProps } from "#/lib/types";import { fetcher } from "#/lib/utils";import { useMemo } from "react";+import { DEFAULT_REDIRECTS } from "../constants";export default function useProject() {const router = useRouter();diff --git a/package.json b/package.jsonindex 1d89a88e90..67fe598fda 100644--- a/package.json+++ b/package.json@@ -58,7 +58,7 @@"js-cookie": "^3.0.5","lucide-react": "^0.269.0","ms": "^2.1.3",- "next": "13.5.3-canary.3",+ "next": "^13.5.4-canary.1","next-auth": "^4.23.1","next-contentlayer": "^0.3.4","node-html-parser": "^6.1.4",diff --git a/pages/app/[slug]/settings/index.tsx b/pages/app/[slug]/settings/index.tsxindex b5d118f62b..5bc4662a3a 100644--- a/pages/app/[slug]/settings/index.tsx+++ b/pages/app/[slug]/settings/index.tsx@@ -36,8 +36,10 @@ export default function ProjectSettingsGeneral() {body: JSON.stringify(updateData),}).then(async (res) => {if (res.status === 200) {- mutate("/api/projects");- mutate(`/api/projects/${slug}`);+ await Promise.all([+ mutate("/api/projects"),+ mutate(`/api/projects/${slug}`),+ ]);toast.success("Successfully updated project name!");} else if (res.status === 422) {toast.error("Project slug already exists");@@ -73,7 +75,7 @@ export default function ProjectSettingsGeneral() {}).then(async (res) => {if (res.status === 200) {const { slug: newSlug } = await res.json();- mutate("/api/projects");+ await mutate("/api/projects");router.push(`/${newSlug}/settings`);toast.success("Successfully updated project slug!");} else if (res.status === 422) {diff --git a/yarn.lock b/yarn.lockindex 57833b6272..13a79f0fa1 100644--- a/yarn.lock+++ b/yarn.lock@@ -1554,10 +1554,10 @@resolved "https://registry.npmjs.org/@next/env/-/env-13.1.6.tgz"integrity sha512-s+W9Fdqh5MFk6ECrbnVmmAOwxKQuhGMT7xXHrkYIBMBcTiOqNWhv5KbJIboKR5STXxNXl32hllnvKaffzFaWQg==-"@next/[email protected]":- version "13.5.3-canary.3"- resolved "https://registry.yarnpkg.com/@next/env/-/env-13.5.3-canary.3.tgz#98ec7d2b8aae8446e1231e419972582a12a4af56"- integrity sha512-vhDotP/VPkDymvLDzYNOKrf5QuBTsV83lVMaJV+SGfE6gYViW6BMHm8be3tEurlAKvoynWJhHq4wbl60f7eUcQ==+"@next/[email protected]":+ version "13.5.4-canary.1"+ resolved "https://registry.yarnpkg.com/@next/env/-/env-13.5.4-canary.1.tgz#05bf10302db8f0ccd0b74198e14aec883f2c237e"+ integrity sha512-PyTaQtq3fsr6F1UvFcHjkqeyM4rP0zq4LF5eus458v3CbliJHuNoAJ5ETJLYDYF4gocGB/UbVsLXcCSYidWnKw=="@next/[email protected]":version "13.1.6"@@ -1574,20 +1574,20 @@resolved "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.1.6.tgz"integrity sha512-KKRQH4DDE4kONXCvFMNBZGDb499Hs+xcFAwvj+rfSUssIDrZOlyfJNy55rH5t2Qxed1e4K80KEJgsxKQN1/fyw==-"@next/[email protected]":- version "13.5.3-canary.3"- resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.5.3-canary.3.tgz#464772f30b5a7baebf4f05b1a91194e70ec6a0ae"- integrity sha512-TzSsgQcsgxM3PK/K/1BrqjWEtWtFl3EQicA/sJcUPQF55DIUqpsHS/vpn8Erz92hxKHlMrIFCOv0G5pTLWzXTQ==+"@next/[email protected]":+ version "13.5.4-canary.1"+ resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.5.4-canary.1.tgz#bf80e8bd2929a4e259e25665fc1826f7aff5e7b1"+ integrity sha512-YamcOSTYrRp+WWwcs6x7ShJPx0NEFuoxjGBTpqhoTFRamJSytCagNUXLpbZvuywLtUdf7L9DH80gj/QknhF8BQ=="@next/[email protected]":version "13.1.6"resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-13.1.6.tgz#e869ac75d16995eee733a7d1550322d9051c1eb4"integrity sha512-/uOky5PaZDoaU99ohjtNcDTJ6ks/gZ5ykTQDvNZDjIoCxFe3+t06bxsTPY6tAO6uEAw5f6vVFX5H5KLwhrkZCA==-"@next/[email protected]":- version "13.5.3-canary.3"- resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-13.5.3-canary.3.tgz#c2bcf5bfc9644fc34f2ede7c6d8b03a85aff1990"- integrity sha512-TsFEhBQgl86fTe4unFt9eQdh3CvnuoqFnSENh4Bj7SgepF4oi7ippYqMMsazE3Bwouua74Fxf+q2+dyH/l0oMw==+"@next/[email protected]":+ version "13.5.4-canary.1"+ resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-13.5.4-canary.1.tgz#1b61cd1ed8e1d3b12126a0f7d47a3c70c2048709"+ integrity sha512-hEeoSEMIJOympsKw8TPx8ffgT7sjBMVwF1wMz0OjGcAqsDcjsfx06pitHVvjrxJzCBia6HC1ts5Tg+gaZD/HuQ=="@next/[email protected]":version "13.1.6"@@ -1604,70 +1604,70 @@resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.1.6.tgz#87a71db21cded3f7c63d1d19079845c59813c53d"integrity sha512-yCH+yDr7/4FDuWv6+GiYrPI9kcTAO3y48UmaIbrKy8ZJpi7RehJe3vIBRUmLrLaNDH3rY1rwoHi471NvR5J5NQ==-"@next/[email protected]":- version "13.5.3-canary.3"- resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.5.3-canary.3.tgz#7df2c2f7d1d2cad40796da639319361e94686828"- integrity sha512-jXCALeY/DvoCnOFQC+TugOe/IqqXwvqAGXCe2pcVrBEqZ8eTH4SUjCxx2TYrea5TOB1VwXRPfLptnHB3H7NG4w==+"@next/[email protected]":+ version "13.5.4-canary.1"+ resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.5.4-canary.1.tgz#e42fb550abbd476237e6d312f5423ab6c34ef445"+ integrity sha512-pRsAGAjWqZi2ED35c2wbfApsJ8IQ+NMGIzg2M6ghEYW48mVC4tORW8G13BLotbkKCjCSLLtlW6unwSqPIjpyRQ=="@next/[email protected]":version "13.1.6"resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.1.6.tgz#c5aac8619331b9fd030603bbe2b36052011e11de"integrity sha512-ECagB8LGX25P9Mrmlc7Q/TQBb9rGScxHbv/kLqqIWs2fIXy6Y/EiBBiM72NTwuXUFCNrWR4sjUPSooVBJJ3ESQ==-"@next/[email protected]":- version "13.5.3-canary.3"- resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.5.3-canary.3.tgz#a1007f2b95355b598322b01c1cd0b77d8dc10125"- integrity sha512-1J1YKjnOAhBuBU7ubhjnGp5Q2VK6t7VVM8orkao5BX5yed/M8FlahAOJIAPeNsXZ3wxrvLkAZkb7Hz/QO60tHA==+"@next/[email protected]":+ version "13.5.4-canary.1"+ resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.5.4-canary.1.tgz#083c956c03e8dcfb6bbcc394485cc26b07e91091"+ integrity sha512-dkkTX5C7RPJoQSkKp/7HqD6vGuJzpqZXEjKk/SfNkW+7cFEz3Zsx5wWDfBkT/geZYNODyxG/nhAAfEa491W/hg=="@next/[email protected]":version "13.1.6"resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.1.6.tgz#9513d36d540bbfea575576746736054c31aacdea"integrity sha512-GT5w2mruk90V/I5g6ScuueE7fqj/d8Bui2qxdw6lFxmuTgMeol5rnzAv4uAoVQgClOUO/MULilzlODg9Ib3Y4Q==-"@next/[email protected]":- version "13.5.3-canary.3"- resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.5.3-canary.3.tgz#5041fa79a75febb61c4a91c8e9b96f3c3b594fd4"- integrity sha512-qv5CkfzCxtRT4RmIvcQDIwofPc73okw9z1DpzjBMu7z8au+pbETwa7pvAXdbuGBL315txi6B4ud4+XmG/wba/g==+"@next/[email protected]":+ version "13.5.4-canary.1"+ resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.5.4-canary.1.tgz#f2e137c53709bbb9c32bd007e76153e5208cf456"+ integrity sha512-7jJTVCGd/uExjgebZQr4k1ml3HEt0AExFoJwtniIMe1iFUyM7bjVyqij+PfuREDOh+N6R9ILDqPHOYUzYr75+Q=="@next/[email protected]":version "13.1.6"resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.1.6.tgz#d61fc6884899f5957251f4ce3f522e34a2c479b7"integrity sha512-keFD6KvwOPzmat4TCnlnuxJCQepPN+8j3Nw876FtULxo8005Y9Ghcl7ACcR8GoiKoddAq8gxNBrpjoxjQRHeAQ==-"@next/[email protected]":- version "13.5.3-canary.3"- resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.5.3-canary.3.tgz#56325b9edc28810579ea4b0e827e39111ac77191"- integrity sha512-nZlkZGOacbr9q6zDk/MPmh7dbVr7/3OUi0otO6N8cTczdw4Puf1PtNB+dmpNCut+ZTUr3b7y74lU+vCy53VU2w==+"@next/[email protected]":+ version "13.5.4-canary.1"+ resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.5.4-canary.1.tgz#1502a53a1e34e670ce2783ff1bf18d9fc4a7595e"+ integrity sha512-402dIEdiLxMNR9QFhqPnGEFTyas9KLA/oPWadR8KzpF+rdJq+2GsoaOTYHAGR0Cydtl4g2TCRUCSrr79b0vdSQ=="@next/[email protected]":version "13.1.6"resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.1.6.tgz#fac2077a8ae9768e31444c9ae90807e64117cda7"integrity sha512-OwertslIiGQluFvHyRDzBCIB07qJjqabAmINlXUYt7/sY7Q7QPE8xVi5beBxX/rxTGPIbtyIe3faBE6Z2KywhQ==-"@next/[email protected]":- version "13.5.3-canary.3"- resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.5.3-canary.3.tgz#6f0c269a61da17173e7e51db961f7f34a2c30408"- integrity sha512-vVh3KzYAe5uvRX8e/gTFOBG0dbCAoxFWS6ETM1bLrCifKRS8u9dDPjZTggd9L1rf3sKErWGpXUjL2510vsNXIQ==+"@next/[email protected]":+ version "13.5.4-canary.1"+ resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.5.4-canary.1.tgz#fc86efe3bcd5fc52a5a70e1fe9a248c74678678a"+ integrity sha512-9S71k/t2/Psl0HWez78NbipmF9oL5YYk9vED2WoOUkfb2vqm536xjH6x9hlTuZdcrypGp6+/81NTyk4+e31A2A=="@next/[email protected]":version "13.1.6"resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.1.6.tgz#498bc11c91b4c482a625bf4b978f98ae91111e46"integrity sha512-g8zowiuP8FxUR9zslPmlju7qYbs2XBtTLVSxVikPtUDQedhcls39uKYLvOOd1JZg0ehyhopobRoH1q+MHlIN/w==-"@next/[email protected]":- version "13.5.3-canary.3"- resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.5.3-canary.3.tgz#0ec654eb2fc90e0fc3e514432223fcb30ccd0442"- integrity sha512-uAoytZJRFHak5xEhTiMgpwxHAE6JrsLTiairQzwb/xw63aajBUeaskJGRtdiJABPFCltiRSMMZonZt1lKEPJIA==+"@next/[email protected]":+ version "13.5.4-canary.1"+ resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.5.4-canary.1.tgz#ea4f788f7cb0f546254422fdff4e2381a0cb9fc9"+ integrity sha512-NaH+padshiH2vj0PJtVibYk5XnJ3jLwm1Q1CrcdNqBlyEDxH2Ky4QcqMf/avQWdfcAvHsTj0T+SERacFGp3pSw=="@next/[email protected]":version "13.1.6"resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.1.6.tgz#17ed919c723426b7d0ce1cd73d40ce3dcd342089"integrity sha512-Ls2OL9hi3YlJKGNdKv8k3X/lLgc3VmLG3a/DeTkAd+lAituJp8ZHmRmm9f9SL84fT3CotlzcgbdaCDfFwFA6bA==-"@next/[email protected]":- version "13.5.3-canary.3"- resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.5.3-canary.3.tgz#1b026f1b9e2a12cdbcaaa70f704887bd1f363552"- integrity sha512-oAIkB4Wckii2DNeFc/Du8F23IpaMZoQ/hC8NyfJSQ4crFcORDVMo61vYNytNC0GVAfrTxsbwmrazBokHztMSeQ==+"@next/[email protected]":+ version "13.5.4-canary.1"+ resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.5.4-canary.1.tgz#8491cd7b310415d86d5715d51391f1731c9f3436"+ integrity sha512-JBWtDlWtny3ftV2LvMoIacqQp0nIE/Yz+Hwfs3bxrrjfymNhkROUpcWAilFEjz9tXY5TajqEl3JKXztGPNabvg=="@nodelib/[email protected]":version "2.1.5"@@ -2422,6 +2422,27 @@aria-hidden "^1.1.1"react-remove-scroll "2.5.4"+"@radix-ui/[email protected]":+ version "1.0.3"+ resolved "https://registry.yarnpkg.com/@radix-ui/react-dialog/-/react-dialog-1.0.3.tgz#a715bf30f35fcd80476c0a07fcc073c1968e6d3e"+ integrity sha512-owNhq36kNPqC2/a+zJRioPg6HHnTn5B/sh/NjTY8r4W9g1L5VJlrzZIVcBr7R9Mg8iLjVmh6MGgMlfoVf/WO/A==+ dependencies:+ "@babel/runtime" "^7.13.10"+ "@radix-ui/primitive" "1.0.0"+ "@radix-ui/react-compose-refs" "1.0.0"+ "@radix-ui/react-context" "1.0.0"+ "@radix-ui/react-dismissable-layer" "1.0.3"+ "@radix-ui/react-focus-guards" "1.0.0"+ "@radix-ui/react-focus-scope" "1.0.2"+ "@radix-ui/react-id" "1.0.0"+ "@radix-ui/react-portal" "1.0.2"+ "@radix-ui/react-presence" "1.0.0"+ "@radix-ui/react-primitive" "1.0.2"+ "@radix-ui/react-slot" "1.0.1"+ "@radix-ui/react-use-controllable-state" "1.0.0"+ aria-hidden "^1.1.1"+ react-remove-scroll "2.5.5"+"@radix-ui/react-dialog@^1.0.4":version "1.0.4"resolved "https://registry.yarnpkg.com/@radix-ui/react-dialog/-/react-dialog-1.0.4.tgz#06bce6c16bb93eb36d7a8589e665a20f4c1c52c1"@@ -2567,9 +2588,9 @@"@radix-ui/react-use-previous" "1.0.0""@radix-ui/react-visually-hidden" "1.0.2"-"@radix-ui/react-popover@^1.0.5":+"@radix-ui/[email protected]":version "1.0.5"- resolved "https://registry.npmjs.org/@radix-ui/react-popover/-/react-popover-1.0.5.tgz"+ resolved "https://registry.yarnpkg.com/@radix-ui/react-popover/-/react-popover-1.0.5.tgz#9c58100ed6809eb611c0acbf032f9ab58c0b55d1"integrity sha512-GRHZ8yD12MrN2NLobHPE8Rb5uHTxd9x372DE9PPNnBjpczAQHcZ5ne0KXG4xpf+RDdXSzdLv9ym6mYJCDTaUZg==dependencies:"@babel/runtime" "^7.13.10"@@ -8397,12 +8418,12 @@ [email protected]:"@next/swc-win32-ia32-msvc" "13.1.6""@next/swc-win32-x64-msvc" "13.1.6"- version "13.5.3-canary.3"- resolved "https://registry.yarnpkg.com/next/-/next-13.5.3-canary.3.tgz#3e6fd5994d05e173b79b5185a841cb67a3bad682"- integrity sha512-XqH3VYXJKVRKdysqYAGUSziHlT9RSwHNAlTvzn30QMSFaFgCBLBT/VZfz05up7XvVY2D3FpVRBQohBmcL2NBTQ==+next@^13.5.4-canary.1:+ version "13.5.4-canary.1"+ resolved "https://registry.yarnpkg.com/next/-/next-13.5.4-canary.1.tgz#b3d529cc9ac27834f399688aca27f0f179375792"+ integrity sha512-XGUtau0aY9coip1K7gRNUcIw4G6Z+UNGVLi3YPUDGhkXkGvOO3rxTyCBj9pE4ObcQyk56orfiH9nfWqT/qRQmw==dependencies:- "@next/env" "13.5.3-canary.3"+ "@next/env" "13.5.4-canary.1""@swc/helpers" "0.5.2"busboy "1.6.0"caniuse-lite "^1.0.30001406"@@ -8411,15 +8432,15 @@ [email protected]:watchpack "2.4.0"zod "3.21.4"optionalDependencies:- "@next/swc-darwin-arm64" "13.5.3-canary.3"- "@next/swc-darwin-x64" "13.5.3-canary.3"- "@next/swc-linux-arm64-gnu" "13.5.3-canary.3"- "@next/swc-linux-arm64-musl" "13.5.3-canary.3"- "@next/swc-linux-x64-gnu" "13.5.3-canary.3"- "@next/swc-linux-x64-musl" "13.5.3-canary.3"- "@next/swc-win32-arm64-msvc" "13.5.3-canary.3"- "@next/swc-win32-ia32-msvc" "13.5.3-canary.3"- "@next/swc-win32-x64-msvc" "13.5.3-canary.3"+ "@next/swc-darwin-arm64" "13.5.4-canary.1"+ "@next/swc-darwin-x64" "13.5.4-canary.1"+ "@next/swc-linux-arm64-gnu" "13.5.4-canary.1"+ "@next/swc-linux-arm64-musl" "13.5.4-canary.1"+ "@next/swc-linux-x64-gnu" "13.5.4-canary.1"+ "@next/swc-linux-x64-musl" "13.5.4-canary.1"+ "@next/swc-win32-arm64-msvc" "13.5.4-canary.1"+ "@next/swc-win32-ia32-msvc" "13.5.4-canary.1"+ "@next/swc-win32-x64-msvc" "13.5.4-canary.1"no-case@^3.0.4:version "3.0.4"