From d6ba465ac6514e2c2bb2848c222457f045747abb Mon Sep 17 00:00:00 2001 From: Chad Elliott Date: Wed, 29 Jan 2025 08:33:56 -0600 Subject: [PATCH] Check array length against explicit value to avoid displaying a zero on load and fixed a "key" warning. --- web-ui/src/pages/SettingsPage.jsx | 22 ++-- .../__snapshots__/SettingsPage.test.jsx.snap | 124 +++++++++--------- 2 files changed, 75 insertions(+), 71 deletions(-) diff --git a/web-ui/src/pages/SettingsPage.jsx b/web-ui/src/pages/SettingsPage.jsx index 16aca3e42a..595da98251 100644 --- a/web-ui/src/pages/SettingsPage.jsx +++ b/web-ui/src/pages/SettingsPage.jsx @@ -61,9 +61,6 @@ const SettingsPage = () => { } }, [state, csrf]); - // For specific settings, add a handleFunction to the settings object. - // Format should be handleSetting and then add it to the handlers object - // with the setting name as the key. const handleLogoUrl = file => { if (csrf) { // TODO: Need to upload the file to a storage bucket... @@ -200,17 +197,20 @@ const SettingsPage = () => { } else { categories[info.category] = true; return ( - <> - {titleCase(info.category)} - - +
+ {titleCase(info.category)} + + +
); } })} - {settingsControls && settingsControls.length && + {// Check length against an explicit value. If length is zero, it will + // be displayed instead of evaluated to false. + settingsControls && settingsControls.length > 0 && selectHasAdministerSettingsPermission(state) &&