diff --git a/lab/src/components/Builder/index.jsx b/lab/src/components/Builder/index.jsx index d433d510b..1449eeb25 100644 --- a/lab/src/components/Builder/index.jsx +++ b/lab/src/components/Builder/index.jsx @@ -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; @@ -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 { diff --git a/lab/src/data/builder/actions.js b/lab/src/data/builder/actions.js index b0a764c45..447d8c1dc 100644 --- a/lab/src/data/builder/actions.js +++ b/lab/src/data/builder/actions.js @@ -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({ @@ -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 }); \ No newline at end of file diff --git a/lab/src/data/builder/index.js b/lab/src/data/builder/index.js index b85cd6701..38ab16be4 100644 --- a/lab/src/data/builder/index.js +++ b/lab/src/data/builder/index.js @@ -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) => { @@ -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;