mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-09 03:32:54 -05:00
Fix redirect to accounts page when no accounts exists (#7007)
* Fix redirect to accounts page when no accounts exists * Add release notes for PR #7007 * Use isFetching --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
180a38890c
commit
da0154a41b
@@ -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() {
|
||||
<Route
|
||||
path="/"
|
||||
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 />
|
||||
)
|
||||
}
|
||||
/>
|
||||
|
||||
6
upcoming-release-notes/7007.md
Normal file
6
upcoming-release-notes/7007.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Bugfixes
|
||||
authors: [joel-jeremy]
|
||||
---
|
||||
|
||||
Fix redirect to accounts page when no accounts exist, improving user experience.
|
||||
Reference in New Issue
Block a user