ensures that removing the last row properly clears rows from form state

This commit is contained in:
James
2020-03-30 19:50:05 -04:00
parent 58c82d89df
commit e38491625b

View File

@@ -48,9 +48,11 @@ function fieldReducer(state, action) {
rowsFromState.splice(rowIndex, 1);
const flattenedRowState = rowsFromState.length > 0 ? flatten({ [name]: rowsFromState }, { filters: flattenFilters }) : {};
return {
...remainingState,
...(flatten({ [name]: rowsFromState }, { filters: flattenFilters })),
...flattenedRowState,
};
}