mirror of
https://github.com/documenso/documenso
synced 2026-04-21 13:27:18 +00:00
perf: parallelize getTeamSettings and getEditorEnvelopeById (#2617)
This commit is contained in:
parent
ac09a48eaa
commit
6ef501c9f2
2 changed files with 20 additions and 16 deletions
|
|
@ -152,9 +152,12 @@ const handleV1Loader = async ({ params, request }: Route.LoaderArgs) => {
|
|||
throw redirect(documentMeta?.redirectUrl || `/sign/${token}/complete`);
|
||||
}
|
||||
|
||||
const [recipientSignature] = await getRecipientSignatures({ recipientId: recipient.id });
|
||||
const [recipientSignatures, settings] = await Promise.all([
|
||||
getRecipientSignatures({ recipientId: recipient.id }),
|
||||
getTeamSettings({ teamId: document.teamId }),
|
||||
]);
|
||||
|
||||
const settings = await getTeamSettings({ teamId: document.teamId });
|
||||
const [recipientSignature] = recipientSignatures;
|
||||
|
||||
return {
|
||||
isDocumentAccessValid: true,
|
||||
|
|
|
|||
|
|
@ -59,20 +59,21 @@ export const loader = async ({ request, params }: Route.LoaderArgs) => {
|
|||
throw new Error('Invalid token');
|
||||
}
|
||||
|
||||
const settings = await getTeamSettings({
|
||||
userId: result.userId,
|
||||
teamId: result.teamId,
|
||||
});
|
||||
|
||||
const envelope = await getEditorEnvelopeById({
|
||||
id: {
|
||||
type: 'envelopeId',
|
||||
id,
|
||||
},
|
||||
type: null,
|
||||
userId: result.userId,
|
||||
teamId: result.teamId,
|
||||
}).catch(() => null);
|
||||
const [settings, envelope] = await Promise.all([
|
||||
getTeamSettings({
|
||||
userId: result.userId,
|
||||
teamId: result.teamId,
|
||||
}),
|
||||
getEditorEnvelopeById({
|
||||
id: {
|
||||
type: 'envelopeId',
|
||||
id,
|
||||
},
|
||||
type: null,
|
||||
userId: result.userId,
|
||||
teamId: result.teamId,
|
||||
}).catch(() => null),
|
||||
]);
|
||||
|
||||
if (!envelope) {
|
||||
throw redirect(`/embed/v2/authoring/error/not-found`);
|
||||
|
|
|
|||
Loading…
Reference in a new issue