Don't prefill notification email for the local-dev bypass account
[email protected] is a fixed, non-deliverable placeholder (no mail relay serves that domain, and Mailpit was removed a while back) - prefilling it was just noise the local dev would always need to clear. Real accounts still get their own email prefilled as before. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
@@ -14,6 +14,7 @@ import { useCompanies, useCreateCompany } from "@/hooks/use-companies";
|
||||
import { useCreateNotificationDestination } from "@/hooks/use-notification-destinations";
|
||||
import { useDiscoverCompany } from "@/hooks/use-discovery";
|
||||
import { authErrorMessage, useCurrentUser, useSystemStatus } from "@/hooks/use-auth";
|
||||
import { isLocalConvenience } from "@/lib/auth";
|
||||
import {
|
||||
FREQUENCY_LABELS,
|
||||
MONITORING_FREQUENCIES,
|
||||
@@ -150,12 +151,17 @@ function AddCompanyWizard() {
|
||||
// Prefill with the account's own email once it loads - `defaultValues`
|
||||
// can't do this since useCurrentUser resolves after the form has already
|
||||
// mounted. Only sets it while the field is still untouched, so it never
|
||||
// clobbers something the user already typed.
|
||||
// clobbers something the user already typed. Skipped for the local-dev
|
||||
// bypass account: its email is a fixed, non-deliverable placeholder
|
||||
// ([email protected] - no mail relay actually serves that domain),
|
||||
// not something worth prefilling - local dev just types whatever real
|
||||
// address they want to test with.
|
||||
const isLocalDev = systemStatus ? isLocalConvenience(systemStatus) : false;
|
||||
useEffect(() => {
|
||||
if (currentUser?.email && !dirtyFields.notificationEmail) {
|
||||
if (currentUser?.email && !isLocalDev && !dirtyFields.notificationEmail) {
|
||||
setValue("notificationEmail", currentUser.email);
|
||||
}
|
||||
}, [currentUser?.email, dirtyFields.notificationEmail, setValue]);
|
||||
}, [currentUser?.email, isLocalDev, dirtyFields.notificationEmail, setValue]);
|
||||
|
||||
const frequencyType = watch("frequencyType");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user