Fix global state issues with Schemes component

This commit is contained in:
Kyle Shockey
2017-08-09 17:06:48 -07:00
parent be293de220
commit 9dee2daa14
3 changed files with 38 additions and 4 deletions

View File

@@ -69,7 +69,10 @@ export default class BaseLayout extends React.Component {
<div className="scheme-container">
<Col className="schemes wrapper" mobile={12}>
{ schemes && schemes.size ? (
<Schemes schemes={ schemes } specActions={ specActions } />
<Schemes
operationScheme={specSelectors.operationScheme()}
schemes={ schemes }
specActions={ specActions } />
) : null }
{ securityDefinitions ? (

View File

@@ -19,7 +19,7 @@ export default class Schemes extends React.Component {
}
componentWillReceiveProps(nextProps) {
if ( !this.props.operationScheme || !nextProps.schemes.has(this.props.operationScheme) ) {
if ( !this.props.operationScheme || !nextProps.schemes.includes(this.props.operationScheme) ) {
// if we don't have a selected operationScheme or if our selected scheme is no longer an option,
// then fire 'change' event and select the first scheme in the list of options
this.setScheme(nextProps.schemes.first())