Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

fix(LanguageSwitcher): add default case to prevent SSR crash on unhandled locale (#1170)

Right Jeongf30521e403bf
diff --git a/frontend/src/components/common/LanguageSwitcher/index.tsx b/frontend/src/components/common/LanguageSwitcher/index.tsx
index da08edbe0..86293728d 100644
--- a/frontend/src/components/common/LanguageSwitcher/index.tsx
+++ b/frontend/src/components/common/LanguageSwitcher/index.tsx
@@ -40,6 +40,13 @@ export const LanguageSwitcher = () => {
return t`Polish`;
case "se":
return t`Swedish`;
+ default:
+ // Defensive fallback: if a new locale is added to SupportedLocales
+ // but not handled here, return the locale code itself rather than
+ // undefined. An undefined label propagates into Mantine's Combobox
+ // `defaultOptionsFilter`, which calls `.toLowerCase()` on it and
+ // throws during SSR, 500-ing every auth page.
+ return locale;
}
};