Skip to content

Commit

Permalink
Improve module loading check
Browse files Browse the repository at this point in the history
  • Loading branch information
nateweller committed Jul 30, 2024
1 parent bf950c7 commit ea84b5a
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions client/my-sites/site-settings/firewall.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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,
};
},
Expand Down

0 comments on commit ea84b5a

Please sign in to comment.