Skip to content

Commit e4d13df

Browse files
NicolappsConvex, Inc.
authored andcommitted
dash: fix 404 after deleting a team (#43548)
GitOrigin-RevId: 7e857ac4d00d660e7e2e02b90a8212d6f148e1e4
1 parent 67f9b7f commit e4d13df

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

npm-packages/dashboard/src/components/teamSettings/TeamSettings.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { TeamResponse } from "generatedApi";
1111
import { Sheet } from "@ui/Sheet";
1212
import { Button } from "@ui/Button";
1313
import { ConfirmationDialog } from "@ui/ConfirmationDialog";
14-
import { useState } from "react";
14+
import { useCallback, useState } from "react";
1515
import startCase from "lodash/startCase";
1616
import { OpenInVercel } from "components/OpenInVercel";
1717
import { TeamForm } from "./TeamForm";
@@ -23,8 +23,15 @@ export function TeamSettings({ team }: { team: TeamResponse }) {
2323
const teamMembers = useTeamMembers(team.id);
2424
const projects = useProjects(team.id);
2525
const [showDeleteTeamModal, setShowDeleteTeamModal] = useState(false);
26-
const deleteTeam = useDeleteTeam(team.id);
2726
const { subscription } = useTeamOrbSubscription(team.id);
27+
28+
const deleteTeam = useDeleteTeam(team.id);
29+
const deleteTeamAndRedirect = useCallback(async () => {
30+
await deleteTeam();
31+
// Completely reload the page to avoid race conditions
32+
window.location.href = "/";
33+
}, [deleteTeam]);
34+
2835
return (
2936
<>
3037
<h2>Team Settings</h2>
@@ -93,7 +100,7 @@ export function TeamSettings({ team }: { team: TeamResponse }) {
93100
{showDeleteTeamModal && (
94101
<ConfirmationDialog
95102
onClose={() => setShowDeleteTeamModal(false)}
96-
onConfirm={deleteTeam}
103+
onConfirm={deleteTeamAndRedirect}
97104
validationText={team.slug}
98105
confirmText="Delete"
99106
dialogTitle="Delete Team"

0 commit comments

Comments
 (0)