A local-first personal finance app
Fix redirect to accounts page when no accounts exists (#7007)
Joel Jeremy Marquezda0154a41b08
diff --git a/packages/desktop-client/src/components/FinancesApp.tsx b/packages/desktop-client/src/components/FinancesApp.tsxindex 9fe9c0c09c..ca05a40041 100644--- a/packages/desktop-client/src/components/FinancesApp.tsx+++ b/packages/desktop-client/src/components/FinancesApp.tsx@@ -92,7 +92,7 @@ export function FinancesApp() {const { t } = useTranslation();// TODO: Replace with `useAccounts` hook once it's updated to return the useQuery results.- const { data: accounts, isSuccess: isAccountsLoaded } = useQuery(+ const { data: accounts, isFetching: isAccountsFetching } = useQuery(accountQueries.list(),);@@ -245,16 +245,14 @@ export function FinancesApp() {<Routepath="/"element={- isAccountsLoaded ? (- accounts.length > 0 ? (- <Navigate to="/budget" replace />- ) : (- // If there are no accounts, we want to redirect the user to- // the All Accounts screen which will prompt them to add an account- <Navigate to="/accounts" replace />- )- ) : (+ isAccountsFetching || !accounts ? (<LoadingIndicator />+ ) : accounts.length > 0 ? (+ <Navigate to="/budget" replace />+ ) : (+ // If there are no accounts, we want to redirect the user to+ // the All Accounts screen which will prompt them to add an account+ <Navigate to="/accounts" replace />)}/>diff --git a/upcoming-release-notes/7007.md b/upcoming-release-notes/7007.mdnew file mode 100644index 0000000000..5f8716dd68--- /dev/null+++ b/upcoming-release-notes/7007.md@@ -0,0 +1,6 @@+---+category: Bugfixes+authors: [joel-jeremy]+---++Fix redirect to accounts page when no accounts exist, improving user experience.