Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1560 from metasfresh/dev-1559
Browse files Browse the repository at this point in the history
Fix errors in the HU Editor window
  • Loading branch information
metas-mk committed Feb 6, 2018
2 parents a8fc7f4 + b37a179 commit 1a351c3
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/components/DataLayoutWrapper.js
Expand Up @@ -39,17 +39,27 @@ class DataLayoutWrapper extends Component {
const { windowType: windowId, viewId } = this.props;
const { dataId: rowId } = this.state;

patchViewAttributes(windowId, viewId, rowId, prop, value).then(response => {
const preparedData = parseToDisplay(response.data[0].fieldsByName);
preparedData &&
Object.keys(preparedData).map(key => {
this.setState(prevState => ({
data: Object.assign({}, prevState.data, {
[key]: Object.assign({}, prevState.data[key], preparedData[key])
})
}));
});
/*eslint-disable */
patchViewAttributes(windowId, viewId, rowId, prop, value).then(({ data }) => {
if (data.length) {
const preparedData = parseToDisplay(data[0].fieldsByName);

if (preparedData) {
Object.keys(preparedData).map(key => {
this.setState({
data: {
...this.state.data,
[key]: {
...this.state.data[key],
...preparedData[key]
}
}
});
});
}
}
});
/*eslint-enable */

cb && cb();
};
Expand Down

0 comments on commit 1a351c3

Please sign in to comment.