Fix hike transition bug

This commit is contained in:
Berkeley Martinez
2016-01-06 15:39:41 -08:00
parent 622974ca2a
commit 1a858fe53c
3 changed files with 27 additions and 7 deletions

View File

@ -48,6 +48,7 @@ export default Store({
toggleQuestions, toggleQuestions,
fetchHikes, fetchHikes,
hideInfo, hideInfo,
resetHike,
grabQuestion, grabQuestion,
releaseQuestion, releaseQuestion,
moveQuestion, moveQuestion,
@ -59,6 +60,7 @@ export default Store({
toggleQuestions, toggleQuestions,
fetchHikes, fetchHikes,
hideInfo, hideInfo,
resetHike,
grabQuestion, grabQuestion,
releaseQuestion, releaseQuestion,
moveQuestion, moveQuestion,

View File

@ -23,12 +23,13 @@ export default contain(
showQuestions: PropTypes.bool showQuestions: PropTypes.bool
}, },
componentWillReceiveProps({ params: { dashedName }, showQuestions }) { componentWillUnmount() {
if ( this.props.hikesActions.resetHike();
showQuestions && },
this.props.params.dashedName !== dashedName
) { componentWillReceiveProps({ params: { dashedName } }) {
this.props.hikesActions.toggleQuestions(); if (this.props.params.dashedName !== dashedName) {
this.props.hikesActions.resetHike();
} }
}, },

View File

@ -175,7 +175,8 @@ export default Actions({
transform(state) { transform(state) {
const hikesApp = { const hikesApp = {
...state.hikesApp, ...state.hikesApp,
mouse: [0, 0] mouse: [0, 0],
showInfo: false
}; };
return { ...state, hikesApp }; return { ...state, hikesApp };
} }
@ -250,5 +251,21 @@ export default Actions({
.catch(err => Observable.just({ .catch(err => Observable.just({
transform(state) { return { ...state, err }; } transform(state) { return { ...state, err }; }
})); }));
},
resetHike() {
return {
transform(state) {
return { ...state,
hikesApp: {
...state.hikesApp,
currentQuestion: 1,
showQuestions: false,
showInfo: false,
mouse: [0, 0],
delta: [0, 0]
}
};
}
};
} }
}); });