Skip to content

Commit

Permalink
Prepopulate integration data with default values
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-ssg committed Feb 14, 2024
1 parent c042dfa commit 0ac67c4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion frontend/web/components/modals/CreateEditIntegrationModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,16 @@ const CreateEditIntegration = class extends Component {
constructor(props, context) {
super(props, context)
const fields = _.cloneDeep(this.props.integration.fields)
const defaultValues = {}
this.props.integration.fields?.forEach((v) => {
if (v.default) {
defaultValues[v.key] = v.default
}
})
this.state = {
data: this.props.data ? { ...this.props.data } : { fields },
data: this.props.data
? { ...this.props.data }
: { fields, ...defaultValues },
fields,
}
if (this.props.id === 'slack' && this.state.data.flagsmithEnvironment) {
Expand Down

0 comments on commit 0ac67c4

Please sign in to comment.