perf: limit # of host members for OG image (#18219)

* fetch only 5 hosts and only first user

* refactor

* limit to 3
This commit is contained in:
Benny Joo authored and GitHub committed 2024-12-17 08:15:11 +00:00
1 parent 14acf4e9bc
commit 42aefc9032
1 file changed
+10 -9
@@ -86,6 +86,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
length: true,
hidden: true,
hosts: {
take: 3,
select: {
user: {
select: {
@@ -135,6 +136,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
where: { id: eventTypeId },
select: {
users: {
take: 1,
select: {
username: true,
name: true,
@@ -143,15 +145,14 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
},
});
users =
data.length > 0
? [
{
username: data[0].username ?? "",
name: data[0].name ?? "",
},
]
: [];
if (data.length > 0) {
users = [
{
username: data[0].username ?? "",
name: data[0].name ?? "",
},
];
}
}
const orgSlug = isValidOrgDomain ? currentOrgDomain : null;