perf: use promise all when possible in RSCs (#23384)

This commit is contained in:
Benny Joo
2025-08-27 08:52:27 -03:00
committed by GitHub
parent d9443162ef
commit 2d9162a4dd
3 changed files with 10 additions and 10 deletions
@@ -21,11 +21,13 @@ const Page = async () => {
createRouterCaller(appsRouter),
]);
const connectedCalendars = await calendarsCaller.connectedCalendars();
const installedCalendars = await appsCaller.integrations({
variant: "calendar",
onlyInstalled: true,
});
const [connectedCalendars, installedCalendars] = await Promise.all([
calendarsCaller.connectedCalendars(),
appsCaller.integrations({
variant: "calendar",
onlyInstalled: true,
}),
]);
return (
<CalendarListContainer connectedCalendars={connectedCalendars} installedCalendars={installedCalendars} />
);
@@ -21,9 +21,9 @@ export const generateMetadata = async () =>
);
const Page = async () => {
const t = await getTranslate();
const [t, _headers, _cookies] = await Promise.all([getTranslate(), headers(), cookies()]);
const session = await getServerSession({ req: buildLegacyRequest(await headers(), await cookies()) });
const session = await getServerSession({ req: buildLegacyRequest(_headers, _cookies) });
if (!session?.user.id || !session?.user.profile?.organizationId || !session?.user.org) {
return redirect("/settings/profile");
@@ -40,9 +40,7 @@ const getCachedRoles = unstable_cache(
const Page = async () => {
const orgCaller = await createRouterCaller(viewerOrganizationsRouter);
const [org, teams] = await Promise.all([orgCaller.listCurrent(), orgCaller.getTeams()]);
const attributes = await getCachedAttributes(org.id);
const roles = await getCachedRoles(org.id);
const [attributes, roles] = await Promise.all([getCachedAttributes(org.id), getCachedRoles(org.id)]);
const facetedTeamValues = {
roles,