From ea84b5ac98e3ad191a33596293fd6a70e2865e0a Mon Sep 17 00:00:00 2001 From: Nate Weller Date: Mon, 29 Jul 2024 18:07:38 -0600 Subject: [PATCH] Improve module loading check --- client/my-sites/site-settings/firewall.jsx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/client/my-sites/site-settings/firewall.jsx b/client/my-sites/site-settings/firewall.jsx index e251f7fa3a2a7..b80aa9a94229d 100644 --- a/client/my-sites/site-settings/firewall.jsx +++ b/client/my-sites/site-settings/firewall.jsx @@ -45,12 +45,16 @@ class Firewall extends Component { }; disableForm() { - return this.props.isRequestingSettings || this.props.isSavingSettings; + return ( + this.props.moduleDetailsLoading || + this.props.isRequestingSettings || + this.props.isSavingSettings + ); } wafModuleSupported = () => { return ( - ! this.props.firewallModuleUnavailable && + this.props.firewallModuleAvailable && ! this.props.isAtomic && ! this.props.isVip && ! this.props.isSimple @@ -239,9 +243,8 @@ export default connect( ( state ) => { const selectedSiteSlug = getSelectedSiteSlug( state ); const selectedSiteId = getSelectedSiteId( state ); - const moduleDetails = getJetpackModule( state, selectedSiteId, 'waf' ); const moduleDetailsLoading = isFetchingJetpackModules( state, selectedSiteId ); - const moduleDetailsNotLoaded = moduleDetails === null; + const firewallModuleDetails = getJetpackModule( state, selectedSiteId, 'waf' ); const siteInDevMode = isJetpackSiteInDevelopmentMode( state, selectedSiteId ); const moduleUnavailableInDevMode = isJetpackModuleUnavailableInDevelopmentMode( state, @@ -254,9 +257,9 @@ export default connect( selectedSiteId, selectedSiteSlug, firewallModuleActive: !! isJetpackModuleActive( state, selectedSiteId, 'waf' ), - firewallModuleUnavailable: - ( moduleDetailsNotLoaded && ! moduleDetailsLoading ) || - ( siteInDevMode && moduleUnavailableInDevMode ), + firewallModuleAvailable: + firewallModuleDetails !== null && ( ! siteInDevMode || ! moduleUnavailableInDevMode ), + moduleDetailsLoading, hasRequiredFeature, }; },