Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
fix(Time Series): corrected issue with uploading multiple data
Browse files Browse the repository at this point in the history
files seperately causing an overwrite of the entire datsets
dictionary. Fixes #261
  • Loading branch information
rashley-iqt committed Mar 14, 2019
1 parent 54ebba5 commit 79d88b8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ class App extends Component {
}

componentWillReceiveProps = (nextProps) =>{
const uniqueUuids = this.state.datasetAdded || nextProps.uuids.length === 0
const datasetAdded = this.state.datasetAdded && (nextProps.uuids.length !== this.state.uuids.length)
const uniqueUuids = datasetAdded || nextProps.uuids.length === 0
? Array.from(new Set(nextProps.uuids.concat(this.state.uuids)))
: nextProps.uuids;
const startUuid = nextProps.startUuid || this.state.startUuid || uniqueUuids[0];
Expand All @@ -76,7 +77,7 @@ class App extends Component {
uuids: uniqueUuids,
startUuid: startUuid,
endUuid: endUuid,
datasetAdded: false
datasetAdded: datasetAdded
});
}

Expand Down Expand Up @@ -194,11 +195,10 @@ class App extends Component {
const uuids = this.state.uuids;
const newItem = uuidv4()
uuids.push(newItem);
this.setState({uuids: uuids});
this.setState({datasetAdded: true});
if(this.state.endUuid === null && uuids.length > 1){
this.setEndUuid(newItem);
}
this.setState({
uuids: uuids,
datasetAdded: true
});
}

removeDatasetEntry = (uuid) =>{
Expand Down
4 changes: 3 additions & 1 deletion src/domain/dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ const reducer = handleActions(
{
[setDatasets]: (state, { payload }) => {
const datasets = payload.datasets;
state.datasets = datasets
Object.keys(datasets).forEach((key) => {
state.datasets[key] = datasets[key];
})

return { ...state};
},
Expand Down

0 comments on commit 79d88b8

Please sign in to comment.