mirror of
https://github.com/wassname/talk.git
synced 2026-08-02 13:10:23 +08:00
Merge pull request #208 from coralproject/fix/dialog-unmount
Check if dialog is present before removing listeners
This commit is contained in:
@@ -25,9 +25,7 @@ export default class CommentList extends React.Component {
|
||||
loading: PropTypes.bool,
|
||||
|
||||
// list of actions (flags, etc) associated with the comments
|
||||
actions: PropTypes.shape({
|
||||
ids: PropTypes.arrayOf(PropTypes.string)
|
||||
}),
|
||||
actions: PropTypes.arrayOf(PropTypes.string),
|
||||
suspectWords: PropTypes.arrayOf(PropTypes.string)
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,9 @@ export default class Dialog extends Component {
|
||||
|
||||
componentWillUnmount() {
|
||||
const dialog = this.dialog;
|
||||
dialog.removeEventListener('cancel', this.props.onCancel);
|
||||
if (dialog) {
|
||||
dialog.removeEventListener('cancel', this.props.onCancel);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
Reference in New Issue
Block a user