From 00a079d6feeb7ff5d7ff8e7603eb4980d407e239 Mon Sep 17 00:00:00 2001 From: Simon Eisenmann Date: Wed, 22 Nov 2023 17:26:10 +0100 Subject: [PATCH] Fix branding settings cache usage The branding settings are delivered as part of the initial hello and then are cached in the state store. Any consumer must use the branding settings from there instead from a potentially different hello state to avoid loosing branding settings. This fixes the flicker of the login form label and bottom text when the login page is submitted. --- identifier/src/containers/Login/Login.jsx | 11 ++++++----- identifier/src/store.js | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/identifier/src/containers/Login/Login.jsx b/identifier/src/containers/Login/Login.jsx index 745667ad..abc5888c 100644 --- a/identifier/src/containers/Login/Login.jsx +++ b/identifier/src/containers/Login/Login.jsx @@ -54,6 +54,7 @@ const styles = theme => ({ function Login(props) { const { hello, + branding, query, dispatch, history, @@ -93,8 +94,8 @@ function Login(props) { }; const usernamePlaceHolder = useMemo(() => { - if (hello?.details?.branding?.usernameHintText ) { - switch (hello.details.branding.usernameHintText) { + if (branding?.usernameHintText ) { + switch (branding.usernameHintText) { case "Username": break; case "Email": @@ -102,12 +103,12 @@ function Login(props) { case "Identity": return t("konnect.login.usernameField.placeholder.identity", "Identity"); default: - return hello.details.branding.usernameHintText; + return branding.usernameHintText; } } return t("konnect.login.usernameField.placeholder.username", "Username"); - }, [hello, t]); + }, [branding, t]); return ( @@ -164,7 +165,7 @@ function Login(props) { ))} - {hello?.details?.branding?.signinPageText && {hello.details.branding.signinPageText}} + {branding?.signinPageText && {branding.signinPageText}} ); diff --git a/identifier/src/store.js b/identifier/src/store.js index c6ba3d77..1fde7bfd 100644 --- a/identifier/src/store.js +++ b/identifier/src/store.js @@ -8,7 +8,7 @@ const middlewares = [ thunkMiddleware ]; -if (process.env.NODE_ENV === 'development') { // eslint-disable-line no-undef +if (process.env.NODE_ENV !== 'development') { // eslint-disable-line no-undef middlewares.push(createLogger()); // must be last middleware in the chain. }