From d8f125f413780f1df0ffb192f096d162385327e0 Mon Sep 17 00:00:00 2001 From: Paul Lessing Date: Thu, 7 Jul 2022 11:01:32 +0100 Subject: [PATCH] Fix: Move logic inline --- app/scenes/Settings/Security.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/scenes/Settings/Security.tsx b/app/scenes/Settings/Security.tsx index 19b98ca3d..b4292fae3 100644 --- a/app/scenes/Settings/Security.tsx +++ b/app/scenes/Settings/Security.tsx @@ -47,11 +47,6 @@ function Security() { const [existingDomainsTouched, setExistingDomainsTouched] = useState(false); - const showSaveDomainsButton = React.useCallback(() => { - const validDomains = allowedDomains.filter((value) => value !== ""); - return existingDomainsTouched || validDomains.length > lastKnownDomainCount; - }, [existingDomainsTouched, allowedDomains, lastKnownDomainCount]); - const authenticationMethods = team.signinMethods; const showSuccessMessage = React.useMemo( @@ -177,6 +172,8 @@ function Security() { } }; + const excludeEmpty = (value: unknown) => value !== ""; + return ( }> {t("Security")} @@ -333,7 +330,9 @@ function Security() { )} - {showSaveDomainsButton() && ( + {(existingDomainsTouched || + allowedDomains.filter(excludeEmpty).length > // New domains were added + lastKnownDomainCount) && (