fix(OAS3): servers component update on definition change (#6280)

* fix(OAS3): servers component should use nextProps

* test(OAS3): cypress tests for selecting multiple servers

* test(OAS3): multiple server test with definition change
This commit is contained in:
Tim Lai
2020-07-31 16:22:17 -07:00
committed by GitHub
parent abcc3837e9
commit 22668ee8d3
4 changed files with 116 additions and 2 deletions

View File

@@ -30,9 +30,9 @@ export default class Servers extends React.Component {
servers,
setServerVariableValue,
getServerVariable
} = this.props
} = nextProps
if(this.props.currentServer !== nextProps.currentServer) {
if (this.props.currentServer !== nextProps.currentServer || this.props.servers !== nextProps.servers) {
// Server has changed, we may need to set default values
let currentServerDefinition = servers
.find(v => v.get("url") === nextProps.currentServer)