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 #1448

Steven Teyc61b68274cca
diff --git a/apps/web/ui/modals/delete-workspace-modal.tsx b/apps/web/ui/modals/delete-workspace-modal.tsx
index d575d5403f..fbee8ae389 100644
--- a/apps/web/ui/modals/delete-workspace-modal.tsx
+++ b/apps/web/ui/modals/delete-workspace-modal.tsx
@@ -1,6 +1,7 @@
import useWorkspace from "@/lib/swr/use-workspace";
import { Button, Logo, Modal, useMediaQuery } from "@dub/ui";
import { cn } from "@dub/utils";
+import { useSession } from "next-auth/react";
import { useParams, useRouter } from "next/navigation";
import {
Dispatch,
@@ -19,6 +20,7 @@ function DeleteWorkspaceModal({
showDeleteWorkspaceModal: boolean;
setShowDeleteWorkspaceModal: Dispatch<SetStateAction<boolean>>;
}) {
+ const { update } = useSession();
const router = useRouter();
const { slug } = useParams() as { slug: string };
const { id, isOwner } = useWorkspace();
@@ -35,7 +37,7 @@ function DeleteWorkspaceModal({
},
}).then(async (res) => {
if (res.ok) {
- await mutate("/api/workspaces");
+ await Promise.all([mutate("/api/workspaces"), update()]);
router.push("/");
resolve(null);
} else {
diff --git a/apps/web/ui/workspaces/create-workspace-form.tsx b/apps/web/ui/workspaces/create-workspace-form.tsx
index 3152e3a11d..b2ece3ac95 100644
--- a/apps/web/ui/workspaces/create-workspace-form.tsx
+++ b/apps/web/ui/workspaces/create-workspace-form.tsx
@@ -4,6 +4,7 @@ import { AlertCircleFill } from "@/ui/shared/icons";
import { Button, InfoTooltip, useMediaQuery } from "@dub/ui";
import { cn } from "@dub/utils";
import slugify from "@sindresorhus/slugify";
+import { useSession } from "next-auth/react";
import { usePlausible } from "next-plausible";
import posthog from "posthog-js";
import { useForm } from "react-hook-form";
@@ -22,6 +23,7 @@ export function CreateWorkspaceForm({
onSuccess?: (data: FormData) => void;
className?: string;
}) {
+ const { update } = useSession();
const plausible = usePlausible();
const {
@@ -59,7 +61,7 @@ export function CreateWorkspaceForm({
workspace_name: data.name,
workspace_slug: data.slug,
});
- await mutate("/api/workspaces");
+ await Promise.all([mutate("/api/workspaces"), update()]);
onSuccess?.(data);
} else {
const { error } = await res.json();