diff --git a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/settings/SettingsPage.test.tsx b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/settings/SettingsPage.test.tsx
index 7e7858f6c71..0563a3946ba 100644
--- a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/settings/SettingsPage.test.tsx
+++ b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/settings/SettingsPage.test.tsx
@@ -2533,4 +2533,33 @@ describe("Settings page", () => {
expect(mockedSessionUpdate).toHaveBeenCalledTimes(1);
});
});
+
+ it("does not crash if no email preferences were found for the current user", () => {
+ const component = (
+
+
+
+ );
+
+ expect(() => render(component)).not.toThrow();
+ });
});
diff --git a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/settings/View.tsx b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/settings/View.tsx
index b49e1497245..adc0fb4e427 100644
--- a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/settings/View.tsx
+++ b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/settings/View.tsx
@@ -20,7 +20,7 @@ export type Props = {
l10n: ExtendedReactLocalization;
user: Session["user"];
subscriber: SubscriberRow;
- data: SubscriberEmailPreferencesOutput;
+ data?: SubscriberEmailPreferencesOutput;
monthlySubscriptionUrl: string;
yearlySubscriptionUrl: string;
subscriptionBillingAmount: {
diff --git a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/settings/panels/SettingsPanelEditInfo.tsx b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/settings/panels/SettingsPanelEditInfo.tsx
index af7c8f15ee6..f16f9aacbb1 100644
--- a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/settings/panels/SettingsPanelEditInfo.tsx
+++ b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/settings/panels/SettingsPanelEditInfo.tsx
@@ -22,7 +22,7 @@ import { onRemoveEmail } from "../actions";
export type SettingsPanelEditInfoProps = {
breachCountByEmailAddress: Record;
- data: SubscriberEmailPreferencesOutput;
+ data?: SubscriberEmailPreferencesOutput;
emailAddresses: SanitizedEmailAddressRow[];
subscriber: SubscriberRow;
user: Session["user"];
diff --git a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/settings/panels/SettingsPanelNotifications.tsx b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/settings/panels/SettingsPanelNotifications.tsx
index aa8125d959c..869280920df 100644
--- a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/settings/panels/SettingsPanelNotifications.tsx
+++ b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/settings/panels/SettingsPanelNotifications.tsx
@@ -22,7 +22,7 @@ import { RadioInput } from "../../../../../../../components/client/RadioInput";
import { CONST_URL_MOZILLA_BASKET } from "../../../../../../../../constants";
export type SettingsPanelNotificationsProps = {
- data: SubscriberEmailPreferencesOutput;
+ data?: SubscriberEmailPreferencesOutput;
subscriber: SubscriberRow;
user: Session["user"];
};
diff --git a/src/db/tables/subscriber_email_preferences.ts b/src/db/tables/subscriber_email_preferences.ts
index b6de77e7829..df767b61097 100644
--- a/src/db/tables/subscriber_email_preferences.ts
+++ b/src/db/tables/subscriber_email_preferences.ts
@@ -285,7 +285,7 @@ async function unsubscribeMonthlyMonitorReportForUnsubscribeToken(
async function getEmailPreferenceForPrimaryEmail(
email: string,
-): Promise {
+): Promise {
logger.info("get_email_preference_for_primary_email", {
email,
});