Skip to content

Commit 075d209

Browse files
feat: remove OAuth clients link from settings navigation (calcom#25206)
* feat: remove OAuth clients link from settings navigation Co-Authored-By: peer@cal.com <peer@cal.com> * fix: resolve infinite loop in sidebar close effect Use functional state update to avoid reading sideContainerOpen in dependency array, which was causing infinite re-renders when navigating between settings pages. Co-Authored-By: peer@cal.com <peer@cal.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 26e8582 commit 075d209

1 file changed

Lines changed: 22 additions & 18 deletions

File tree

apps/web/app/(use-page-wrapper)/settings/(settings-layout)/SettingsLayoutAppDirClient.tsx

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@radix-ui/react-collapsible";
44
import { useSession } from "next-auth/react";
5+
import Image from "next/image";
56
import Link from "next/link";
67
import { usePathname, useRouter } from "next/navigation";
78
import type { ComponentProps } from "react";
@@ -101,8 +102,6 @@ const getTabs = (orgBranding: OrganizationBranding | null) => {
101102
name: "privacy_and_security",
102103
href: "/settings/organizations/privacy",
103104
},
104-
105-
{ name: "OAuth Clients", href: "/settings/organizations/platform/oauth-clients" },
106105
{
107106
name: "SSO",
108107
href: "/settings/organizations/sso",
@@ -173,7 +172,6 @@ const organizationRequiredKeys = ["organization"];
173172
const organizationAdminKeys = [
174173
"privacy",
175174
"privacy_and_security",
176-
"OAuth Clients",
177175
"SSO",
178176
"directory_sync",
179177
"delegation_credential",
@@ -358,11 +356,12 @@ const TeamListCollapsible = ({ teamFeatures }: { teamFeatures?: Record<number, T
358356
const [teamMenuState, setTeamMenuState] =
359357
useState<{ teamId: number | undefined; teamMenuOpen: boolean }[]>();
360358
const searchParams = useCompatSearchParams();
359+
const searchParamsId = searchParams?.get("id");
361360
useEffect(() => {
362361
if (teams) {
363362
const teamStates = teams?.map((team) => ({
364363
teamId: team.id,
365-
teamMenuOpen: String(team.id) === searchParams?.get("id"),
364+
teamMenuOpen: String(team.id) === searchParamsId,
366365
}));
367366
setTeamMenuState(teamStates);
368367
setTimeout(() => {
@@ -372,7 +371,7 @@ const TeamListCollapsible = ({ teamFeatures }: { teamFeatures?: Record<number, T
372371
tabMembers?.scrollIntoView({ behavior: "smooth" });
373372
}, 100);
374373
}
375-
}, [searchParams?.get("id"), teams]);
374+
}, [searchParamsId, teams]);
376375

377376
return (
378377
<>
@@ -431,9 +430,11 @@ const TeamListCollapsible = ({ teamFeatures }: { teamFeatures?: Record<number, T
431430
)}
432431
</div>
433432
{!team.parentId && (
434-
<img
433+
<Image
435434
src={getPlaceholderAvatar(team.logoUrl, team.name)}
436-
className="h-[16px] w-[16px] self-start rounded-full stroke-[2px] ltr:mr-2 rtl:ml-2 md:mt-0"
435+
width={16}
436+
height={16}
437+
className="self-start rounded-full stroke-[2px] ltr:mr-2 rtl:ml-2 md:mt-0"
437438
alt={team.name || "Team logo"}
438439
/>
439440
)}
@@ -554,12 +555,13 @@ const SettingsSidebarContainer = ({
554555
enabled: !!session.data?.user?.org,
555556
});
556557

558+
const searchParamsId = searchParams?.get("id");
557559
// Same as above but for otherTeams
558560
useEffect(() => {
559561
if (otherTeams) {
560562
const otherTeamStates = otherTeams?.map((team) => ({
561563
teamId: team.id,
562-
teamMenuOpen: String(team.id) === searchParams?.get("id"),
564+
teamMenuOpen: String(team.id) === searchParamsId,
563565
}));
564566
setOtherTeamMenuState(otherTeamStates);
565567
setTimeout(() => {
@@ -570,7 +572,7 @@ const SettingsSidebarContainer = ({
570572
tabMembers?.scrollIntoView({ behavior: "smooth" });
571573
}, 100);
572574
}
573-
}, [searchParams?.get("id"), otherTeams]);
575+
}, [searchParamsId, otherTeams]);
574576

575577
return (
576578
<nav
@@ -599,8 +601,10 @@ const SettingsSidebarContainer = ({
599601
/>
600602
)}
601603
{!tab.icon && tab?.avatar && (
602-
<img
603-
className="h-4 w-4 rounded-full ltr:mr-3 rtl:ml-3"
604+
<Image
605+
width={16}
606+
height={16}
607+
className="rounded-full ltr:mr-3 rtl:ml-3"
604608
src={tab?.avatar}
605609
alt="Organization Logo"
606610
/>
@@ -750,9 +754,11 @@ const SettingsSidebarContainer = ({
750754
)}
751755
</div>
752756
{!otherTeam.parentId && (
753-
<img
757+
<Image
754758
src={getPlaceholderAvatar(otherTeam.logoUrl, otherTeam.name)}
755-
className="h-[16px] w-[16px] self-start rounded-full stroke-[2px] ltr:mr-2 rtl:ml-2 md:mt-0"
759+
width={16}
760+
height={16}
761+
className="self-start rounded-full stroke-[2px] ltr:mr-2 rtl:ml-2 md:mt-0"
756762
alt={otherTeam.name || "Team logo"}
757763
/>
758764
)}
@@ -852,13 +858,11 @@ export default function SettingsLayoutAppDirClient({
852858
return () => {
853859
window.removeEventListener("resize", closeSideContainer);
854860
};
855-
}, []);
861+
}, [setSideContainerOpen]);
856862

857863
useEffect(() => {
858-
if (sideContainerOpen) {
859-
setSideContainerOpen(!sideContainerOpen);
860-
}
861-
}, [pathname]);
864+
setSideContainerOpen((prev) => (prev ? false : prev));
865+
}, [pathname, setSideContainerOpen]);
862866

863867
return (
864868
<Shell

0 commit comments

Comments
 (0)