Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default class AttachIssueModal extends PureComponent {
owner,
repo,
number,
comment: this.props.post.message,
comment: this.state.comment,
post_id: this.props.post.id,
show_attached_message: true,
};
Expand Down Expand Up @@ -106,9 +106,17 @@ export default class AttachIssueModal extends PureComponent {
});
};

/* eslint-disable react/no-did-update-set-state*/
Comment thread
Nityanand13 marked this conversation as resolved.
Outdated
componentDidUpdate(prevProps) {
if (this.props.post && !this.props.messageData && !prevProps.post) {
this.setState({comment: this.props.post.message});
}
}
/* eslint-enable */

render() {
const {error, submitting, comment, issueValue} = this.state;
const {visible, theme, messageData, post} = this.props;
const {visible, theme, messageData} = this.props;
const style = getStyle(theme);
if (!visible) {
return null;
Expand Down Expand Up @@ -138,10 +146,9 @@ export default class AttachIssueModal extends PureComponent {
<Input
label='Message Attached to GitHub Issue'
type='textarea'
isDisabled={false}
value={post?.message}
value={comment}
disabled={false}
readOnly={true}
onChange={this.handleIssueCommentChange}
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const initialState = {
repo: null,
issueTitle: '',
issueDescription: '',
channelID: '',
channelId: '',
labels: [],
assignees: [],
milestone: null,
Expand Down Expand Up @@ -62,23 +62,23 @@ export default class CreateOrUpdateIssueModal extends PureComponent {
labels = [];
}

this.setState({assignees});
this.setState({labels});
this.setState({milestone: {
value: milestone_number,
label: milestone_title,
},
repo: {
name: repo_full_name,
},
channelID: channel_id,
assignees,
labels,
channelId: channel_id,
issueDescription: description,
issueTitle: title.substring(0, MAX_TITLE_LENGTH)});
}

/* eslint-disable react/no-did-update-set-state*/
componentDidUpdate(prevProps) {
if (this.props.post && !this.props.messageData) {
if (this.props.post && !this.props.messageData && !prevProps.post) {
this.setState({issueDescription: this.props.post.message});
}

Expand Down Expand Up @@ -118,7 +118,7 @@ export default class CreateOrUpdateIssueModal extends PureComponent {
assignees: this.state.assignees,
milestone: this.state.milestone && this.state.milestone.value,
post_id: postId,
channel_id: this.state.channelID,
channel_id: this.state.channelId,
issue_number,
};

Expand Down Expand Up @@ -252,6 +252,7 @@ export default class CreateOrUpdateIssueModal extends PureComponent {
onChange={this.handleIssueTitleChange}
/>
{issueTitleValidationError}

Comment thread
Nityanand13 marked this conversation as resolved.
{this.renderIssueAttributeSelectors()}

<Input
Expand Down