Skip to content

Commit

Permalink
fix: change environment in settings page (#3956)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-ssg authored May 15, 2024
1 parent 796564a commit 0d30180
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions frontend/web/components/pages/EnvironmentSettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ const EnvironmentSettingsPage = class extends Component {

componentDidMount = () => {
API.trackPage(Constants.pages.ENVIRONMENT_SETTINGS)
this.getEnvironment()
this.props.getWebhooks()
}

getEnvironment = () => {
const env = ProjectStore.getEnvs().find(
(v) => v.api_key === this.props.match.params.environmentId,
)
Expand All @@ -69,8 +74,6 @@ const EnvironmentSettingsPage = class extends Component {
this.setState({ roles: matchingItems })
})
})

this.props.getWebhooks()
}

onSave = () => {
Expand All @@ -83,6 +86,12 @@ const EnvironmentSettingsPage = class extends Component {
) {
AppActions.getProject(this.props.match.params.projectId)
}
if (
this.props.match.params.environmentId !==
prevProps.match.params.environmentId
) {
this.getEnvironment()
}
}

onRemove = () => {
Expand Down Expand Up @@ -236,8 +245,10 @@ const EnvironmentSettingsPage = class extends Component {
api_key: this.props.match.params.environmentId,
})
if (
env &&
typeof this.state.minimum_change_request_approvals === 'undefined'
(env &&
typeof this.state.minimum_change_request_approvals ===
'undefined') ||
this.state.env?.api_key !== this.props.match.params.environmentId
) {
setTimeout(() => {
this.setState({
Expand Down

0 comments on commit 0d30180

Please sign in to comment.