From cc497b29ab6ec15f1ff9ccf4c7cbba4648e46348 Mon Sep 17 00:00:00 2001
From: Matiss Janis Aboltins <matiss@mja.lv>
Date: Fri, 7 Jul 2023 19:17:45 +0100
Subject: [PATCH] :bug:  changing pages while adding a transaction (#1305)

---
 packages/desktop-client/src/components/accounts/Account.js | 5 +++++
 upcoming-release-notes/1305.md                             | 6 ++++++
 2 files changed, 11 insertions(+)
 create mode 100644 upcoming-release-notes/1305.md

diff --git a/packages/desktop-client/src/components/accounts/Account.js b/packages/desktop-client/src/components/accounts/Account.js
index d67b3cb3c..cc7b16373 100644
--- a/packages/desktop-client/src/components/accounts/Account.js
+++ b/packages/desktop-client/src/components/accounts/Account.js
@@ -216,6 +216,11 @@ class AccountInternal extends PureComponent {
   }
 
   componentDidUpdate(prevProps) {
+    // If the active account changes - close the transaction entry mode
+    if (this.state.isAdding && this.props.accountId !== prevProps.accountId) {
+      this.setState({ isAdding: false });
+    }
+
     // If the user was on a different screen and is now coming back to
     // the transactions, automatically refresh the transaction to make
     // sure we have updated state
diff --git a/upcoming-release-notes/1305.md b/upcoming-release-notes/1305.md
new file mode 100644
index 000000000..23d1760db
--- /dev/null
+++ b/upcoming-release-notes/1305.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [MatissJanis]
+---
+
+Close the "add transaction" entry mode when switching between accounts
-- 
GitLab