diff --git a/packages/webapp/src/components/maps-page/language-menu/index.tsx b/packages/webapp/src/components/maps-page/language-menu/index.tsx index 46f6b00e..517cb80c 100644 --- a/packages/webapp/src/components/maps-page/language-menu/index.tsx +++ b/packages/webapp/src/components/maps-page/language-menu/index.tsx @@ -26,15 +26,19 @@ const LanguageMenu = (): React.ReactElement => { const open = Boolean(anchorEl); const intl = useIntl(); - const mutation = useMutation((locale: LocaleCode) => client.updateAccountLanguage(locale), { - onSuccess: () => { - queryClient.invalidateQueries('account'); - handleClose(); + // Todo: For some reasons, in some situations locale is null. More research needed. + const mutation = useMutation( + (locale: LocaleCode) => client.updateAccountLanguage(locale ? locale : 'en'), + { + onSuccess: () => { + queryClient.invalidateQueries('account'); + handleClose(); + }, + onError: (error) => { + console.error(`Unexpected error ${error}`); + }, }, - onError: (error) => { - console.error(`Unexpected error ${error}`); - }, - }); + ); const handleMenu = (event: React.MouseEvent) => { setAnchorEl(event.currentTarget);