Fix dz, and auto open repeatable compo

Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
soupette 2020-10-29 17:48:04 +01:00
parent 55b5fcc672
commit a8eb79de6d
2 changed files with 3 additions and 1 deletions

View File

@ -56,6 +56,7 @@ const RepeatableComponent = ({
}, [componentValueLength]);
const { collapses } = state.toJS();
const toggleCollapses = index => {
dispatch({
type: 'TOGGLE_COLLAPSE',
@ -79,6 +80,7 @@ const RepeatableComponent = ({
)}
<div ref={drop}>
{componentValueLength > 0 &&
componentValueLength === collapses.length &&
componentValue.map((data, index) => {
const componentFieldName = `${name}.${index}`;
const doesPreviousFieldContainErrorsAndIsOpen =

View File

@ -37,7 +37,7 @@ const reducer = (state, action) => {
const newCollapses = Array.from({ length: collapsesLength }).map((_, i) => {
const shouldOpenLastCollapse = state.get('shouldOpenLastCollapse');
const isOpen = shouldOpenLastCollapse && i === action.dataLength.length - 1;
const isOpen = shouldOpenLastCollapse && i === action.dataLength - 1;
return {
isOpen,