perf(web, lib): do not await inside promise statements (#692)

This commit is contained in:
Szymon Sus
2023-11-28 23:10:15 +01:00
committed by GitHub
parent adc97802ea
commit 7e4c44e820
2 changed files with 4 additions and 4 deletions

View File

@ -43,11 +43,11 @@ export default async function DocumentPage({ params }: DocumentPageProps) {
const { documentData } = document; const { documentData } = document;
const [recipients, fields] = await Promise.all([ const [recipients, fields] = await Promise.all([
await getRecipientsForDocument({ getRecipientsForDocument({
documentId, documentId,
userId: user.id, userId: user.id,
}), }),
await getFieldsForDocument({ getFieldsForDocument({
documentId, documentId,
userId: user.id, userId: user.id,
}), }),

View File

@ -32,7 +32,7 @@ export const findUsers = async ({
}); });
const [users, count] = await Promise.all([ const [users, count] = await Promise.all([
await prisma.user.findMany({ prisma.user.findMany({
include: { include: {
Subscription: true, Subscription: true,
Document: { Document: {
@ -45,7 +45,7 @@ export const findUsers = async ({
skip: Math.max(page - 1, 0) * perPage, skip: Math.max(page - 1, 0) * perPage,
take: perPage, take: perPage,
}), }),
await prisma.user.count({ prisma.user.count({
where: whereClause, where: whereClause,
}), }),
]); ]);