Skip to content

Commit

Permalink
error message bug fix
Browse files Browse the repository at this point in the history
Former-commit-id: 6887960
  • Loading branch information
Coder-Sharon committed Aug 13, 2018
1 parent 57123c9 commit 5a8cc0e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
11 changes: 6 additions & 5 deletions lab/src/components/Builder/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ class Builder extends Component {
}
}

componentWillUnmount() {
const { defaultAlgorithms, setCurrentAlgorithm, clearError } = this.props;
setCurrentAlgorithm(defaultAlgorithms[0]);
clearError();
}

handleSubmitExperiment() {
const dataset = this.props.dataset || this.state.dataset;
const { currentAlgorithm, currentParams, submitExperiment } = this.props;
Expand All @@ -56,11 +62,6 @@ class Builder extends Component {
setCurrentAlgorithm(currentAlgorithm);
}

componentWillUnmount() {
const { defaultAlgorithms, setCurrentAlgorithm } = this.props;
setCurrentAlgorithm(defaultAlgorithms[0]);
}

render() {
const dataset = this.props.dataset || this.state.dataset;
const {
Expand Down
5 changes: 5 additions & 0 deletions lab/src/data/builder/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const SUBMIT_EXPERIMENT_SUCCESS = 'SUBMIT_EXPERIMENT_SUCCESS';
export const SUBMIT_EXPERIMENT_FAILURE = 'SUBMIT_EXPERIMENT_FAILURE';
export const SET_CURRENT_ALGORITHM = 'SET_CURRENT_ALGORITHM';
export const SET_PARAM_VALUE = 'SET_PARAM_VALUE';
export const CLEAR_ERROR = 'CLEAR_ERROR';

export const submitExperiment = (algorithm, params) => (dispatch) => {
dispatch({
Expand Down Expand Up @@ -34,4 +35,8 @@ export const setCurrentAlgorithm = (algorithm) => ({
export const setParamValue = (param, value) => ({
type: SET_PARAM_VALUE,
payload: { param, value }
});

export const clearError = () => ({
type: CLEAR_ERROR
});
4 changes: 3 additions & 1 deletion lab/src/data/builder/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import {
SUBMIT_EXPERIMENT_SUCCESS,
SUBMIT_EXPERIMENT_FAILURE,
SET_CURRENT_ALGORITHM,
SET_PARAM_VALUE
SET_PARAM_VALUE,
CLEAR_ERROR
} from './actions';

const currentAlgorithm = (state = {}, action) => {
Expand Down Expand Up @@ -52,6 +53,7 @@ const error = (state = null, action) => {
return action.payload;
case SUBMIT_EXPERIMENT_REQUEST:
case SUBMIT_EXPERIMENT_SUCCESS:
case CLEAR_ERROR:
return null;
default:
return state;
Expand Down

0 comments on commit 5a8cc0e

Please sign in to comment.