From cb84d53dd55784f83e3c52f5c1a1bfcc85da3c48 Mon Sep 17 00:00:00 2001 From: Gustav Hansen Date: Mon, 28 Aug 2023 12:42:24 +0200 Subject: [PATCH] fix(authenticatedApp): catch errors for user id generation silently --- .../admin/src/components/AuthenticatedApp.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/core/admin/admin/src/components/AuthenticatedApp.js b/packages/core/admin/admin/src/components/AuthenticatedApp.js index fd63f662e6..9164ed50a8 100644 --- a/packages/core/admin/admin/src/components/AuthenticatedApp.js +++ b/packages/core/admin/admin/src/components/AuthenticatedApp.js @@ -136,8 +136,12 @@ export const AuthenticatedApp = () => { // Create a hash of the users email adress and use it as ID for tracking React.useEffect(() => { const generateUserId = async (userInfo) => { - const userId = await hashAdminUserEmail(userInfo); - setUserId(userId); + try { + const userId = await hashAdminUserEmail(userInfo); + setUserId(userId); + } catch (error) { + console.error('Generating user id failed', error); + } }; if (userInfo) { @@ -170,13 +174,7 @@ export const AuthenticatedApp = () => { const hasApluginNotReady = Object.values(plugins).some((plugin) => plugin.isReady === false); - if ( - !userDisplayName || - !userId || - isLoadingAppInfos || - isLoadingPermissions || - hasApluginNotReady - ) { + if (isLoadingAppInfos || isLoadingPermissions || hasApluginNotReady) { const initializers = Object.keys(plugins).reduce((acc, current) => { const InitializerComponent = plugins[current].initializer;