fixes bug with repeater and flex content reinitializing too often

This commit is contained in:
James
2020-06-19 16:31:23 -04:00
parent 30e7fde537
commit e06f90da2b
5 changed files with 17 additions and 10 deletions

View File

@@ -26,8 +26,7 @@ const reduceFieldsToValues = (fields) => {
}
});
const unflattened = unflatten(data);
const unflattened = unflatten(data, { safe: true });
return unflattened;
};

View File

@@ -105,7 +105,7 @@ class Relationship extends Component {
if (hasMultipleRelations) {
options.forEach((option) => {
const potentialValue = option.options.find((subOption) => {
if (subOption.value && subOption.value.value && value && value.value) {
if (subOption?.value?.value && value?.value) {
return subOption.value.value === value.value;
}

View File

@@ -108,7 +108,7 @@ const Repeater = (props) => {
},
]), []),
});
}, [dataToInitialize, setValue]);
}, [dataToInitialize]);
return (
<DragDropContext onDragEnd={onDragEnd}>
@@ -143,6 +143,8 @@ const Repeater = (props) => {
initialData={row.data}
dispatchRows={dispatchRows}
customComponentsPath={`${customComponentsPath}${name}.fields.`}
positionHandleVerticalAlignment="sticky"
actionHandleVerticalAlignment="sticky"
/>
);
})

View File

@@ -39,6 +39,10 @@
&:disabled {
background: $color-light-gray;
color: $color-gray;
&:hover {
border-color: $color-light-gray;
}
}
@include small-break {

View File

@@ -74,14 +74,16 @@ $style-stroke-width-m : 2px;
}
@mixin inputShadow {
@include shadow-sm;
@include shadow-sm;
&:hover {
box-shadow: 0 2px 3px 0 rgba(0, 2, 4, 0.13), 0 6px 4px -4px rgba(0, 2, 4, 0.1);
}
&:not(:disabled) {
&:hover {
box-shadow: 0 2px 3px 0 rgba(0, 2, 4, 0.13), 0 6px 4px -4px rgba(0, 2, 4, 0.1);
}
&:active, &:focus {
@include inputShadowActive;
&:active, &:focus {
@include inputShadowActive;
}
}
}