From 0bf805fe2caf537ff0b2ecc853e4199b831f1119 Mon Sep 17 00:00:00 2001 From: Sigve Kvalsvik Date: Wed, 1 Nov 2017 16:59:07 +0100 Subject: [PATCH] Add some limitations to the worker budget object loop --- app/components/Account/AccountVoting.jsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/components/Account/AccountVoting.jsx b/app/components/Account/AccountVoting.jsx index 413a67fae1..e8fab22b2d 100644 --- a/app/components/Account/AccountVoting.jsx +++ b/app/components/Account/AccountVoting.jsx @@ -26,14 +26,12 @@ class AccountVoting extends React.Component { static propTypes = { initialBudget: ChainTypes.ChainObject.isRequired, globalObject: ChainTypes.ChainObject.isRequired, - dynamicGlobal: ChainTypes.ChainObject.isRequired, proxy: ChainTypes.ChainAccount.isRequired }; static defaultProps = { initialBudget: SettingsStore.getState().viewSettings.get("lastBudgetObject", "2.13.1"), - globalObject: "2.0.0", - dynamicGlobal: "2.1.0" + globalObject: "2.0.0" }; constructor(props) { @@ -362,14 +360,16 @@ class AccountVoting extends React.Component { this.setState({lastBudgetObject: newID}); } else { - if (lastBudgetObject !== "2.13.1") { - let newBudgetObjectId = parseInt(lastBudgetObject.split(".")[2], 10) - 1; + const newBudgetObjectId = parseInt(lastBudgetObject.split(".")[2], 10) - 1; + if (typeof newBudgetObjectId === "number" && newBudgetObjectId > 1) { + + const lastId = Math.max(1, newBudgetObjectId - 1); this.setState({ - lastBudgetObject: "2.13." + (newBudgetObjectId - 1) + lastBudgetObject: "2.13." + lastId }); SettingsActions.changeViewSetting.defer({ - lastBudgetObject: "2.13." + (newBudgetObjectId - 1) + lastBudgetObject: "2.13." + lastId }); } }