Skip to content

Commit

Permalink
Merge branch 'develop' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Schiessl committed Oct 25, 2019
2 parents c0026d8 + 3e5ce7c commit 5bf4a3a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
29 changes: 24 additions & 5 deletions app/components/Settings/SettingsEntry.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export default class SettingsEntry extends React.Component {

this.state = {
message: null,
isGatewaySelectorModalVisible: false
isGatewaySelectorModalVisible: false,
isGatewaySelectorModalRendered: false
};

this.handleNotificationChange = this.handleNotificationChange.bind(
Expand All @@ -33,6 +34,7 @@ export default class SettingsEntry extends React.Component {

showGatewaySelectorModal() {
this.setState({
isGatewaySelectorModalRendered: true,
isGatewaySelectorModalVisible: true
});
}
Expand All @@ -57,6 +59,17 @@ export default class SettingsEntry extends React.Component {
};
}

shouldComponentUpdate(nextProps, nextState, nextContext) {
if (nextProps.setting === "filteredServiceProviders") {
// only rerender for the modal, not when settings changed (visualized in the modal!)
return (
nextState.isGatewaySelectorModalVisible !==
this.state.isGatewaySelectorModalVisible
);
}
return true;
}

render() {
let {defaults, setting, settings} = this.props;
let options,
Expand Down Expand Up @@ -173,10 +186,16 @@ export default class SettingsEntry extends React.Component {
>
Choose external Service Providers
</Button>
<GatewaySelectorModal
visible={this.state.isGatewaySelectorModalVisible}
hideModal={this.hideGatewaySelectorModal.bind(this)}
/>
{this.state.isGatewaySelectorModalRendered && (
<GatewaySelectorModal
visible={
this.state.isGatewaySelectorModalVisible
}
hideModal={this.hideGatewaySelectorModal.bind(
this
)}
/>
)}
</React.Fragment>
);
break;
Expand Down
1 change: 0 additions & 1 deletion app/stores/SettingsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,6 @@ class SettingsStore {
default:
break;
}
console.log("asdsad");
// check current settings
if (this.settings.get(payload.setting) !== payload.value) {
this.settings = this.settings.set(payload.setting, payload.value);
Expand Down

0 comments on commit 5bf4a3a

Please sign in to comment.