Avoid going over the maximum allowed number of poll responses

This commit is contained in:
Maxim Khlobystov 2021-04-05 19:41:26 +00:00
parent 9d4bd0e199
commit 11fe501214

View File

@ -245,6 +245,8 @@ class Poll extends Component {
setOptListLength(len) {
const { optList } = this.state;
len = len > MAX_CUSTOM_FIELDS ? MAX_CUSTOM_FIELDS : len;
const diff = len - optList.length;
if (diff > 0) {
const emptyAddition = Array(diff).fill({ val: '' });