Skip to content

A local-first personal finance app

Fixes editing closed account names issue #616 (#620)

Nithun Harikrishnand24d8fb7dd2b
diff --git a/packages/desktop-client/src/components/accounts/Account.js b/packages/desktop-client/src/components/accounts/Account.js
index 5349d15913..f8fb0762d2 100644
--- a/packages/desktop-client/src/components/accounts/Account.js
+++ b/packages/desktop-client/src/components/accounts/Account.js
@@ -717,7 +717,9 @@ const AccountHeader = React.memo(
marginBottom: 5
}}
>
- {accountName}
+ {account && account.closed
+ ? 'Closed: ' + accountName
+ : accountName}
</View>
{account && <NotesButton id={`account-${account.id}`} />}
@@ -739,7 +741,9 @@ const AccountHeader = React.memo(
<View
style={{ fontSize: 25, fontWeight: 500, marginBottom: 5 }}
>
- {accountName}
+ {account && account.closed
+ ? 'Closed: ' + accountName
+ : accountName}
</View>
)}
</View>
@@ -1319,12 +1323,14 @@ class AccountInternal extends React.PureComponent {
};
onSaveName = name => {
- const accountId = this.props.accountId;
- const account = this.props.accounts.find(
- account => account.id === accountId
- );
- this.props.updateAccount({ ...account, name });
- this.setState({ editingName: false });
+ if (name.trim().length) {
+ const accountId = this.props.accountId;
+ const account = this.props.accounts.find(
+ account => account.id === accountId
+ );
+ this.props.updateAccount({ ...account, name });
+ this.setState({ editingName: false });
+ }
};
onToggleExtraBalances = () => {
@@ -1391,7 +1397,7 @@ class AccountInternal extends React.PureComponent {
return null;
}
- return (account.closed ? 'Closed: ' : '') + account.name;
+ return account.name;
}
getBalanceQuery(account, id) {