diff --git a/frontend/web/components/pages/EnvironmentSettingsPage.js b/frontend/web/components/pages/EnvironmentSettingsPage.js index 4ba9dfa4782a..be6e40352447 100644 --- a/frontend/web/components/pages/EnvironmentSettingsPage.js +++ b/frontend/web/components/pages/EnvironmentSettingsPage.js @@ -67,6 +67,8 @@ const EnvironmentSettingsPage = class extends Component { { organisation_id: AccountStore.getOrganisation().id }, { forceRefetch: true }, ).then((roles) => { + if (!roles?.data?.results?.length) return + getRoleEnvironmentPermissions( getStore(), { @@ -76,7 +78,6 @@ const EnvironmentSettingsPage = class extends Component { }, { forceRefetch: true }, ).then((res) => { - debugger const matchingItems = roles.data.results.filter((item1) => res.data.results.some((item2) => item2.role === item1.id), ) @@ -156,7 +157,7 @@ const EnvironmentSettingsPage = class extends Component { api_key: this.props.match.params.environmentId, }) - const { description, name } = this.state + const { name } = this.state if (ProjectStore.isSaving || !name) { return } @@ -166,7 +167,7 @@ const EnvironmentSettingsPage = class extends Component { allow_client_traits: !!this.state.allow_client_traits, banner_colour: this.state.banner_colour, banner_text: this.state.banner_text, - description: description || env.description, + description: this.state?.env?.description, hide_disabled_flags: this.state.hide_disabled_flags, hide_sensitive_data: !!this.state.hide_sensitive_data, minimum_change_request_approvals: has4EyesPermission @@ -365,17 +366,16 @@ const EnvironmentSettingsPage = class extends Component { (this.input = e)} - value={ - typeof this.state.description === 'string' - ? this.state.description - : env.description - } + value={this.state?.env?.description ?? ''} inputProps={{ className: 'input--wide textarea-lg', }} onChange={(e) => this.setState({ - description: Utils.safeParseEventValue(e), + env: { + ...this.state.env, + description: Utils.safeParseEventValue(e), + }, }) } isValid={name && name.length} diff --git a/frontend/web/components/pages/ProjectSettingsPage.js b/frontend/web/components/pages/ProjectSettingsPage.js index 265b2e1cb209..ea8c8261f612 100644 --- a/frontend/web/components/pages/ProjectSettingsPage.js +++ b/frontend/web/components/pages/ProjectSettingsPage.js @@ -60,6 +60,8 @@ const ProjectSettingsPage = class extends Component { { organisation_id: AccountStore.getOrganisation().id }, { forceRefetch: true }, ).then((roles) => { + if (!roles?.data?.results?.length) return + getRoleProjectPermissions( getStore(), {