From 6f73c51b1255d134ec4af2493eaf8034d82107e4 Mon Sep 17 00:00:00 2001 From: Aaron Lindsay Date: Sat, 8 Aug 2015 07:24:22 -0400 Subject: [PATCH] Fix exception --- static/account_register.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/static/account_register.js b/static/account_register.js index 4fbd531..e82c34d 100644 --- a/static/account_register.js +++ b/static/account_register.js @@ -417,17 +417,21 @@ const AccountRegister = React.createClass({ }, componentWillReceiveProps: function(nextProps) { if (nextProps.selectedAccount != this.props.selectedAccount) { + this.setState({ + selectedTransaction: new Transaction(), + transactions: [] + }); this.getTransactionPage(nextProps.selectedAccount, 0); console.log("TODO begin fetching transactions for new account"); } }, render: function() { var name = "Please select an account"; - if (this.props.selectedAccount != null) + register = []; + + if (this.props.selectedAccount != null) { name = this.props.selectedAccount.Name; - register = []; - if (this.props.selectedAccount != null) { var newTransaction = new Transaction(); newTransaction.Description = "Create New Transaction..."; newTransaction.Status = TransactionStatus.Entered;