A local-first personal finance app
:test_tube: improve onboarding e2e test stability (#3503)
Matiss Janis Aboltinsc497d3a941ec
diff --git a/packages/desktop-client/src/components/FinancesApp.tsx b/packages/desktop-client/src/components/FinancesApp.tsxindex 73b8948ad5..c6d71930ef 100644--- a/packages/desktop-client/src/components/FinancesApp.tsx+++ b/packages/desktop-client/src/components/FinancesApp.tsx@@ -31,6 +31,7 @@ import { TransactionEdit } from './mobile/transactions/TransactionEdit';import { Notifications } from './Notifications';import { ManagePayeesPage } from './payees/ManagePayeesPage';import { Reports } from './reports';+import { LoadingIndicator } from './reports/LoadingIndicator';import { NarrowAlternate, WideComponent } from './responsive';import { Settings } from './settings';import { FloatableSidebar } from './sidebar';@@ -65,19 +66,6 @@ function WideNotSupported({ children, redirectTo = '/budget' }) {}function RouterBehaviors() {- const navigate = useNavigate();- const accounts = useAccounts();- const accountsLoaded = useSelector(- (state: State) => state.queries.accountsLoaded,- );- useEffect(() => {- // If there are no accounts, we want to redirect the user to- // the All Accounts screen which will prompt them to add an account- if (accountsLoaded && accounts.length === 0) {- navigate('/accounts');- }- }, [accountsLoaded, accounts]);-const location = useLocation();const href = useHref(location);useEffect(() => {@@ -91,6 +79,11 @@ export function FinancesApp() {const dispatch = useDispatch();const { t } = useTranslation();+ const accounts = useAccounts();+ const accountsLoaded = useSelector(+ (state: State) => state.queries.accountsLoaded,+ );+const [lastUsedVersion, setLastUsedVersion] = useLocalPref('flags.updateNotificationShownForVersion',);@@ -180,7 +173,22 @@ export function FinancesApp() {<BankSyncStatus /><Routes>- <Route path="/" element={<Navigate to="/budget" replace />} />+ <Route+ path="/"+ element={+ accountsLoaded ? (+ 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 />+ )+ ) : (+ <LoadingIndicator />+ )+ }+ /><Route path="/reports/*" element={<Reports />} />diff --git a/upcoming-release-notes/3503.md b/upcoming-release-notes/3503.mdnew file mode 100644index 0000000000..4ae2f6204a--- /dev/null+++ b/upcoming-release-notes/3503.md@@ -0,0 +1,6 @@+---+category: Maintenance+authors: [MatissJanis]+---++e2e: improve onboarding test stability.