mirror of
https://github.com/documenso/documenso.git
synced 2026-07-25 17:35:05 +10:00
fix: guard send dialogs against org claim races
First-open send flows can render before organisationClaim is available. Guard email-domain access and delay sender lookup to avoid route 500s.
This commit is contained in:
@@ -79,6 +79,7 @@ export const AddSubjectFormPartial = ({
|
||||
const { _ } = useLingui();
|
||||
|
||||
const organisation = useCurrentOrganisation();
|
||||
const hasOrganisationEmailDomains = Boolean(organisation.organisationClaim?.flags.emailDomains);
|
||||
|
||||
const form = useForm<TAddSubjectFormSchema>({
|
||||
defaultValues: {
|
||||
@@ -106,10 +107,15 @@ export const AddSubjectFormPartial = ({
|
||||
} = form;
|
||||
|
||||
const { data: emailData, isLoading: isLoadingEmails } =
|
||||
trpc.enterprise.organisation.email.find.useQuery({
|
||||
organisationId: organisation.id,
|
||||
perPage: 100,
|
||||
});
|
||||
trpc.enterprise.organisation.email.find.useQuery(
|
||||
{
|
||||
organisationId: organisation.id,
|
||||
perPage: 100,
|
||||
},
|
||||
{
|
||||
enabled: hasOrganisationEmailDomains,
|
||||
},
|
||||
);
|
||||
|
||||
const emails = emailData?.data || [];
|
||||
|
||||
@@ -212,7 +218,7 @@ export const AddSubjectFormPartial = ({
|
||||
className="flex flex-col gap-y-4 rounded-lg border p-4"
|
||||
disabled={form.formState.isSubmitting}
|
||||
>
|
||||
{organisation.organisationClaim.flags.emailDomains && (
|
||||
{hasOrganisationEmailDomains && (
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="meta.emailId"
|
||||
|
||||
Reference in New Issue
Block a user