diff --git a/src/ic/ic-dialog.js b/src/ic/ic-dialog.js index 9b29d9c..6e225a5 100644 --- a/src/ic/ic-dialog.js +++ b/src/ic/ic-dialog.js @@ -16,9 +16,18 @@ class ICDialog extends React.Component { this.state = { confirmCommand: false, command: '', + icStatus: {} }; } + static getDerivedStateFromProps(props, state){ + if(typeof props.icStatus !== 'undefined'){ + return {icStatus: props.icStatus} + } else { + return {} + } + } + onClose(canceled) { this.props.onClose(); } @@ -47,7 +56,7 @@ class ICDialog extends React.Component { render() { - let icStatus = this.props.icStatus; + let icStatus = this.state.icStatus; delete icStatus['icID']; let objectURL='' @@ -72,32 +81,32 @@ class ICDialog extends React.Component { { typeof icStatus !== "undefined" && Object.keys(icStatus).map(statusKey => ( typeof icStatus[statusKey] === 'object' ? - (
+ (
{ Object.keys(icStatus[statusKey]).map(key => ( typeof icStatus[statusKey][key] === 'object' ? - (
+ (
{Object.keys(icStatus[statusKey][key]).map(index => ( -
{index + ": " + icStatus[statusKey][key][index]}
+
{index + ": " + icStatus[statusKey][key][index]}
))}
) : - (
{key + ": " + icStatus[statusKey][key]}
) + (
{key + ": " + icStatus[statusKey][key]}
) )) }
) : - (
{statusKey + ": " + icStatus[statusKey]}
) + (
{statusKey + ": " + icStatus[statusKey]}
) )) }