fix(authenticatedApp): catch errors for user id generation silently

This commit is contained in:
Gustav Hansen 2023-08-28 12:42:24 +02:00
parent 00b155bacf
commit cb84d53dd5

View File

@ -136,8 +136,12 @@ export const AuthenticatedApp = () => {
// Create a hash of the users email adress and use it as ID for tracking // Create a hash of the users email adress and use it as ID for tracking
React.useEffect(() => { React.useEffect(() => {
const generateUserId = async (userInfo) => { const generateUserId = async (userInfo) => {
try {
const userId = await hashAdminUserEmail(userInfo); const userId = await hashAdminUserEmail(userInfo);
setUserId(userId); setUserId(userId);
} catch (error) {
console.error('Generating user id failed', error);
}
}; };
if (userInfo) { if (userInfo) {
@ -170,13 +174,7 @@ export const AuthenticatedApp = () => {
const hasApluginNotReady = Object.values(plugins).some((plugin) => plugin.isReady === false); const hasApluginNotReady = Object.values(plugins).some((plugin) => plugin.isReady === false);
if ( if (isLoadingAppInfos || isLoadingPermissions || hasApluginNotReady) {
!userDisplayName ||
!userId ||
isLoadingAppInfos ||
isLoadingPermissions ||
hasApluginNotReady
) {
const initializers = Object.keys(plugins).reduce((acc, current) => { const initializers = Object.keys(plugins).reduce((acc, current) => {
const InitializerComponent = plugins[current].initializer; const InitializerComponent = plugins[current].initializer;