Skip to content

Scheduling infrastructure for absolutely everyone.

fix: add fallback to data needed in SettingsLayout (#17004)

Benny Joo670b82fd2365
diff --git a/packages/features/settings/appDir/SettingsLayoutAppDirClient.tsx b/packages/features/settings/appDir/SettingsLayoutAppDirClient.tsx
index 16af97a7171..770b9750d5c 100644
--- a/packages/features/settings/appDir/SettingsLayoutAppDirClient.tsx
+++ b/packages/features/settings/appDir/SettingsLayoutAppDirClient.tsx
@@ -10,7 +10,7 @@ import React, { useEffect, useState, useMemo } from "react";
import { useOrgBranding } from "@calcom/features/ee/organizations/context/provider";
import Shell from "@calcom/features/shell/Shell";
import { classNames } from "@calcom/lib";
-import { HOSTED_CAL_FEATURES, WEBAPP_URL } from "@calcom/lib/constants";
+import { HOSTED_CAL_FEATURES, IS_CALCOM, WEBAPP_URL } from "@calcom/lib/constants";
import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage";
import { getUserAvatarUrl } from "@calcom/lib/getAvatarUrl";
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
@@ -141,6 +141,9 @@ tabs.find((tab) => {
// TODO: Enable dsync for self hosters
// tab.children?.push({ name: "directory_sync", href: "/settings/security/dsync" });
}
+ if (tab.name === "admin" && IS_CALCOM) {
+ tab.children?.push({ name: "create_license_key", href: "/settings/license-key/new" });
+ }
});
// The following keys are assigned to admin only
@@ -393,8 +396,8 @@ const SettingsSidebarContainer = ({
className = "",
navigationIsOpenedOnMobile,
bannersHeight,
- currentOrg,
- otherTeams,
+ currentOrg: currentOrgProp,
+ otherTeams: otherTeamsProp,
}: SettingsSidebarContainerProps) => {
const searchParams = useCompatSearchParams();
const { t } = useLocale();
@@ -405,7 +408,16 @@ const SettingsSidebarContainer = ({
teamMenuOpen: boolean;
}[]
>();
-
+ const session = useSession();
+ const { data: _currentOrg } = trpc.viewer.organizations.listCurrent.useQuery(undefined, {
+ enabled: !!session.data?.user?.org && !currentOrgProp,
+ });
+
+ const { data: _otherTeams } = trpc.viewer.organizations.listOtherTeams.useQuery(undefined, {
+ enabled: !!session.data?.user?.org && !otherTeamsProp,
+ });
+ const currentOrg = currentOrgProp ?? _currentOrg;
+ const otherTeams = otherTeamsProp ?? _otherTeams;
// Same as above but for otherTeams
useEffect(() => {
if (otherTeams) {