From d093fe013c14d2ef01fe4773ff0c15f928e6048e Mon Sep 17 00:00:00 2001 From: vrde Date: Tue, 14 Jul 2015 23:11:23 +0200 Subject: [PATCH] Add awful hack to handle redirect on login and collection pages --- js/components/ascribe_forms/form_login.js | 3 ++- js/components/piece_list.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/js/components/ascribe_forms/form_login.js b/js/components/ascribe_forms/form_login.js index 408aaf73..7fd8a4dd 100644 --- a/js/components/ascribe_forms/form_login.js +++ b/js/components/ascribe_forms/form_login.js @@ -56,7 +56,8 @@ let LoginForm = React.createClass({ // if user is already logged in, redirect him to piece list if(this.state.currentUser && this.state.currentUser.email && this.props.redirectOnLoggedIn) { - this.transitionTo('pieces'); + // FIXME: hack to redirect out of the dispatch cycle + window.setTimeout(() => this.transitionTo('pieces'), 0); } }, diff --git a/js/components/piece_list.js b/js/components/piece_list.js index 39426391..711f53ea 100644 --- a/js/components/piece_list.js +++ b/js/components/piece_list.js @@ -41,7 +41,8 @@ let PieceList = React.createClass({ componentDidUpdate() { if (this.props.redirectTo && this.state.pieceListCount === 0) { - this.transitionTo(this.props.redirectTo); + // FIXME: hack to redirect out of the dispatch cycle + window.setTimeout(() => this.transitionTo(this.props.redirectTo), 0); } },