Skip to content

Commit e9c3a74

Browse files
d-banraymond-lam
authored andcommitted
Fix: Cannot open certain element without opening all of them one by one #285
1 parent 70cc351 commit e9c3a74

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/formBuilder/utils.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,14 @@ export function generateElementComponentsFromSchemas(parameters: {
11031103
});
11041104

11051105
const elementList = elementPropArr.map((elementProp, index) => {
1106+
const MIN_CARD_OPEN_ARRAY_LENGTH = index + 1;
1107+
const currentLength = cardOpenArray.length;
1108+
1109+
if (currentLength < MIN_CARD_OPEN_ARRAY_LENGTH) {
1110+
cardOpenArray.push(
1111+
...new Array(MIN_CARD_OPEN_ARRAY_LENGTH - currentLength).fill(false),
1112+
);
1113+
}
11061114
const expanded =
11071115
(cardOpenArray && index < cardOpenArray.length && cardOpenArray[index]) ||
11081116
false;

0 commit comments

Comments
 (0)