perf: Slim down trpc queries in Settings Layout (#20918)
* slim down settings layout by removing server queries * add check method * fix type check * refactor
This commit is contained in:
1 parent
513f54f4fe
commit
d844fd6ef7
5 files changed
+33
-54
No files matched your search
@@ -1,8 +1,8 @@
|
||||
import SkeletonLoaderTeamList from "@calcom/ee/teams/components/SkeletonloaderTeamList";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { EmptyScreen } from "@calcom/ui/components/empty-screen";
|
||||
import { Alert } from "@calcom/ui/components/alert";
|
||||
import { EmptyScreen } from "@calcom/ui/components/empty-screen";
|
||||
|
||||
import OtherTeamList from "./OtherTeamList";
|
||||
|
||||
|
||||
@@ -305,6 +305,13 @@ export class OrganizationRepository {
|
||||
},
|
||||
},
|
||||
},
|
||||
select: {
|
||||
parentId: true,
|
||||
id: true,
|
||||
name: true,
|
||||
logoUrl: true,
|
||||
slug: true,
|
||||
},
|
||||
});
|
||||
|
||||
return teamsInOrgIamNotPartOf;
|
||||
|
||||
@@ -44,6 +44,14 @@ const checkDelegationCredentialFeature = async ({
|
||||
};
|
||||
|
||||
export const delegationCredentialRouter = router({
|
||||
check: authedOrgAdminProcedure.query(async (opts) => {
|
||||
return await checkDelegationCredentialFeature({
|
||||
ctx: opts.ctx,
|
||||
next: async () => ({
|
||||
hasDelegationCredential: true,
|
||||
}),
|
||||
});
|
||||
}),
|
||||
list: authedOrgAdminProcedure.use(checkDelegationCredentialFeature).query(async (opts) => {
|
||||
const handler = await import("./list.handler").then((mod) => mod.default);
|
||||
return handler(opts);
|
||||
|
||||
Reference in new issue
Block a user