Skip to content

A local-first personal finance app

Fix transaction list page being blank on mobile (#1171)

Jed Fox0e7de456f619
diff --git a/packages/desktop-client/src/components/FinancesApp.js b/packages/desktop-client/src/components/FinancesApp.js
index 8d6c3bc5cc..c977e3c430 100644
--- a/packages/desktop-client/src/components/FinancesApp.js
+++ b/packages/desktop-client/src/components/FinancesApp.js
@@ -9,7 +9,6 @@ import {
NavLink,
useNavigate,
BrowserRouter,
- useParams,
} from 'react-router-dom';
import hotkeys from 'hotkeys-js';
@@ -144,7 +143,7 @@ function StackedRoutesInner({ location }) {
<Route
path="/accounts/:id"
- element={<AccountCmp isNarrowWidth={isNarrowWidth} />}
+ element={isNarrowWidth ? <MobileAccount /> : <Account />}
/>
<Route
@@ -155,14 +154,6 @@ function StackedRoutesInner({ location }) {
);
}
-// Needed to re-mount the component for each account ID change
-function AccountCmp(props) {
- const { id } = useParams();
- const Component = props.isNarrowWidth ? MobileAccount : Account;
-
- return <Component key={id} {...props} />;
-}
-
function NavTab({ icon: TabIcon, name, path }) {
return (
<NavLink
diff --git a/packages/desktop-client/src/components/accounts/Account.js b/packages/desktop-client/src/components/accounts/Account.js
index 1dcd56c381..296af367f1 100644
--- a/packages/desktop-client/src/components/accounts/Account.js
+++ b/packages/desktop-client/src/components/accounts/Account.js
@@ -1290,7 +1290,7 @@ class AccountInternal extends PureComponent {
}
componentWillReceiveProps(nextProps) {
- if (this.props.match !== nextProps.match) {
+ if (this.props.accountId !== nextProps.accountId) {
this.setState(
{
editingName: false,
diff --git a/packages/desktop-client/src/components/budget/index.js b/packages/desktop-client/src/components/budget/index.js
index a706a90697..b14ab02678 100644
--- a/packages/desktop-client/src/components/budget/index.js
+++ b/packages/desktop-client/src/components/budget/index.js
@@ -111,7 +111,7 @@ class Budget extends PureComponent {
_initialBudgetMonth = this.state.startMonth;
}
- if (this.props.match && !prevProps.match) {
+ if (this.props.accountId !== prevProps.accountId) {
// Make to sure to check if the budget bounds have changed, and
// if so reload the budget data
send('get-budget-bounds').then(({ start, end }) => {
diff --git a/upcoming-release-notes/1171.md b/upcoming-release-notes/1171.md
new file mode 100644
index 0000000000..518894fb99
--- /dev/null
+++ b/upcoming-release-notes/1171.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [j-f1]
+---
+
+Fix transaction list page being blank on mobile