diff --git a/components/interactive_dialog/interactive_dialog.jsx b/components/interactive_dialog/interactive_dialog.jsx
index adf095ce36df..265bd2d6fb9b 100644
--- a/components/interactive_dialog/interactive_dialog.jsx
+++ b/components/interactive_dialog/interactive_dialog.jsx
@@ -17,7 +17,7 @@ export default class InteractiveDialog extends React.Component {
static propTypes = {
url: PropTypes.string.isRequired,
callbackId: PropTypes.string,
- elements: PropTypes.arrayOf(PropTypes.object).isRequired,
+ elements: PropTypes.arrayOf(PropTypes.object),
title: PropTypes.string.isRequired,
iconUrl: PropTypes.string,
submitLabel: PropTypes.string,
@@ -33,9 +33,11 @@ export default class InteractiveDialog extends React.Component {
super(props);
const values = {};
- props.elements.forEach((e) => {
- values[e.name] = e.default || null;
- });
+ if (props.elements != null) {
+ props.elements.forEach((e) => {
+ values[e.name] = e.default || null;
+ });
+ }
this.state = {
show: true,
@@ -51,18 +53,20 @@ export default class InteractiveDialog extends React.Component {
const {elements} = this.props;
const values = this.state.values;
const errors = {};
- elements.forEach((elem) => {
- const error = checkDialogElementForError(elem, values[elem.name]);
- if (error) {
- errors[elem.name] = (
-
- );
- }
- });
+ if (elements) {
+ elements.forEach((elem) => {
+ const error = checkDialogElementForError(elem, values[elem.name]);
+ if (error) {
+ errors[elem.name] = (
+
+ );
+ }
+ });
+ }
this.setState({errors});
@@ -160,7 +164,10 @@ export default class InteractiveDialog extends React.Component {
role='dialog'
aria-labelledby='interactiveDialogModalLabel'
>
-
+
-
+ {elements &&
{elements.map((e) => {
return (
);
})}
-
+ }