Fix web UI crash on page load when detailed status has a poll (#10139)
parent
6d08fd5170
commit
21246d861e
|
@ -45,7 +45,7 @@ export default @injectIntl
|
|||
class Poll extends ImmutablePureComponent {
|
||||
|
||||
static propTypes = {
|
||||
poll: ImmutablePropTypes.map.isRequired,
|
||||
poll: ImmutablePropTypes.map,
|
||||
intl: PropTypes.object.isRequired,
|
||||
dispatch: PropTypes.func,
|
||||
disabled: PropTypes.bool,
|
||||
|
@ -122,6 +122,11 @@ class Poll extends ImmutablePureComponent {
|
|||
|
||||
render () {
|
||||
const { poll, intl } = this.props;
|
||||
|
||||
if (!poll) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const timeRemaining = timeRemainingString(intl, new Date(poll.get('expires_at')), intl.now());
|
||||
const showResults = poll.get('voted') || poll.get('expired');
|
||||
const disabled = this.props.disabled || Object.entries(this.state.selected).every(item => !item);
|
||||
|
|
Loading…
Reference in New Issue