A local-first personal finance app
[Redux Toolkit Migration] Use new Redux Toolkit configureStore API (#4000)
Joel Jeremy Marquezcc1c11aac94a
diff --git a/packages/desktop-client/package.json b/packages/desktop-client/package.jsonindex 358eee5354..19b8078ace 100644--- a/packages/desktop-client/package.json+++ b/packages/desktop-client/package.json@@ -24,7 +24,6 @@"@types/react-dom": "^18.2.1","@types/react-grid-layout": "^1","@types/react-modal": "^3.16.0",- "@types/react-redux": "^7.1.25","@types/uuid": "^9.0.2","@types/webpack-bundle-analyzer": "^4.6.3","@use-gesture/react": "^10.3.0",@@ -61,15 +60,13 @@"react-i18next": "^14.1.2","react-markdown": "^8.0.7","react-modal": "3.16.1",- "react-redux": "7.2.9",+ "react-redux": "^9.2.0","react-router-dom": "6.21.3","react-simple-pull-to-refresh": "^1.3.3","react-spring": "^9.7.3","react-stately": "^3.33.0","react-virtualized-auto-sizer": "^1.0.21","recharts": "^2.10.4",- "redux": "^4.2.1",- "redux-thunk": "^2.4.2","remark-gfm": "^3.0.1","rollup-plugin-visualizer": "^5.12.0","sass": "^1.70.0",diff --git a/packages/desktop-client/src/auth/AuthProvider.tsx b/packages/desktop-client/src/auth/AuthProvider.tsxindex e0d5903783..987184f6b2 100644--- a/packages/desktop-client/src/auth/AuthProvider.tsx+++ b/packages/desktop-client/src/auth/AuthProvider.tsx@@ -1,9 +1,7 @@import React, { createContext, useContext, type ReactNode } from 'react';-import { useSelector } from 'react-redux';--import { type State } from 'loot-core/client/state-types';import { useServerURL } from '../components/ServerContext';+import { useSelector } from '../redux';import { type Permissions } from './types';@@ -18,7 +16,7 @@ type AuthProviderProps = {};export const AuthProvider = ({ children }: AuthProviderProps) => {- const userData = useSelector((state: State) => state.user.data);+ const userData = useSelector(state => state.user.data);const serverUrl = useServerURL();const hasPermission = (permission?: Permissions) => {diff --git a/packages/desktop-client/src/auth/ProtectedRoute.tsx b/packages/desktop-client/src/auth/ProtectedRoute.tsxindex 5dacd05578..0dad71a1c3 100644--- a/packages/desktop-client/src/auth/ProtectedRoute.tsx+++ b/packages/desktop-client/src/auth/ProtectedRoute.tsx@@ -1,10 +1,10 @@import { useEffect, useState, type ReactElement } from 'react';-import { useSelector } from 'react-redux';import { type RemoteFile, type SyncedLocalFile } from 'loot-core/types/file';import { View } from '../components/common/View';import { useMetadataPref } from '../hooks/useMetadataPref';+import { useSelector } from '../redux';import { useAuth } from './AuthProvider';import { type Permissions } from './types';diff --git a/packages/desktop-client/src/components/App.tsx b/packages/desktop-client/src/components/App.tsxindex acc0f361c8..f914d04f7c 100644--- a/packages/desktop-client/src/components/App.tsx+++ b/packages/desktop-client/src/components/App.tsx@@ -9,7 +9,6 @@ import {} from 'react-error-boundary';import { HotkeysProvider } from 'react-hotkeys-hook';import { useTranslation } from 'react-i18next';-import { useDispatch, useSelector } from 'react-redux';import { BrowserRouter } from 'react-router-dom';import {@@ -20,7 +19,6 @@ import {sync,} from 'loot-core/client/actions';import { SpreadsheetProvider } from 'loot-core/client/SpreadsheetProvider';-import { type State } from 'loot-core/client/state-types';import * as Platform from 'loot-core/src/client/platform';import {init as initConnection,@@ -30,6 +28,7 @@ import {import { useActions } from '../hooks/useActions';import { useMetadataPref } from '../hooks/useMetadataPref';import { installPolyfills } from '../polyfills';+import { useDispatch, useSelector } from '../redux';import { styles, hasHiddenScrollbars, ThemeStyle, useTheme } from '../style';import { ExposeNavigate } from '../util/router-tools';@@ -51,7 +50,7 @@ function AppInner() {const { t } = useTranslation();const { showBoundary: showErrorBoundary } = useErrorBoundary();const dispatch = useDispatch();- const userData = useSelector((state: State) => state.user.data);+ const userData = useSelector(state => state.user.data);const { signOut, addNotification } = useActions();const maybeUpdate = async <T,>(cb?: () => T): Promise<T> => {diff --git a/packages/desktop-client/src/components/AppBackground.tsx b/packages/desktop-client/src/components/AppBackground.tsxindex 9d57bafdde..423412e31e 100644--- a/packages/desktop-client/src/components/AppBackground.tsx+++ b/packages/desktop-client/src/components/AppBackground.tsx@@ -1,10 +1,10 @@import React from 'react';-import { useSelector } from 'react-redux';import { useTransition, animated } from 'react-spring';import { css } from '@emotion/css';import { AnimatedLoading } from '../icons/AnimatedLoading';+import { useSelector } from '../redux';import { theme } from '../style';import { Background } from './Background';diff --git a/packages/desktop-client/src/components/BankSyncStatus.tsx b/packages/desktop-client/src/components/BankSyncStatus.tsxindex 52130e0c19..843b62d3e3 100644--- a/packages/desktop-client/src/components/BankSyncStatus.tsx+++ b/packages/desktop-client/src/components/BankSyncStatus.tsx@@ -1,10 +1,8 @@import React from 'react';import { Trans } from 'react-i18next';-import { useSelector } from 'react-redux';import { useTransition, animated } from 'react-spring';-import { type State } from 'loot-core/src/client/state-types';-+import { useSelector } from '../redux';import { theme, styles } from '../style';import { AnimatedRefresh } from './AnimatedRefresh';@@ -12,9 +10,7 @@ import { Text } from './common/Text';import { View } from './common/View';export function BankSyncStatus() {- const accountsSyncing = useSelector(- (state: State) => state.account.accountsSyncing,- );+ const accountsSyncing = useSelector(state => state.account.accountsSyncing);const accountsSyncingCount = accountsSyncing.length;const count = accountsSyncingCount;diff --git a/packages/desktop-client/src/components/FinancesApp.tsx b/packages/desktop-client/src/components/FinancesApp.tsxindex 8b987636ee..a1074fbf3e 100644--- a/packages/desktop-client/src/components/FinancesApp.tsx+++ b/packages/desktop-client/src/components/FinancesApp.tsx@@ -1,7 +1,6 @@// @ts-strict-ignoreimport React, { type ReactElement, useEffect, useRef } from 'react';import { useTranslation } from 'react-i18next';-import { useDispatch, useSelector } from 'react-redux';import {Route,Routes,@@ -11,7 +10,6 @@ import {} from 'react-router-dom';import { addNotification, sync } from 'loot-core/client/actions';-import { type State } from 'loot-core/src/client/state-types';import * as undo from 'loot-core/src/platform/client/undo';import { ProtectedRoute } from '../auth/ProtectedRoute';@@ -20,6 +18,7 @@ import { useAccounts } from '../hooks/useAccounts';import { useLocalPref } from '../hooks/useLocalPref';import { useMetaThemeColor } from '../hooks/useMetaThemeColor';import { useNavigate } from '../hooks/useNavigate';+import { useSelector, useDispatch } from '../redux';import { theme } from '../style';import { getIsOutdated, getLatestVersion } from '../util/versions';@@ -90,9 +89,7 @@ export function FinancesApp() {const { t } = useTranslation();const accounts = useAccounts();- const accountsLoaded = useSelector(- (state: State) => state.queries.accountsLoaded,- );+ const accountsLoaded = useSelector(state => state.queries.accountsLoaded);const [lastUsedVersion, setLastUsedVersion] = useLocalPref('flags.updateNotificationShownForVersion',diff --git a/packages/desktop-client/src/components/HelpMenu.tsx b/packages/desktop-client/src/components/HelpMenu.tsxindex e0e790dc74..11c292add3 100644--- a/packages/desktop-client/src/components/HelpMenu.tsx+++ b/packages/desktop-client/src/components/HelpMenu.tsx@@ -1,7 +1,6 @@import { forwardRef, useRef } from 'react';import { useHotkeys } from 'react-hotkeys-hook';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { useLocation } from 'react-router-dom';import { useToggle } from 'usehooks-ts';@@ -11,6 +10,7 @@ import { pushModal } from 'loot-core/client/actions/modals';import { useFeatureFlag } from '../hooks/useFeatureFlag';import { SvgHelp } from '../icons/v2/Help';+import { useDispatch } from '../redux';import { Button } from './common/Button2';import { Menu } from './common/Menu';diff --git a/packages/desktop-client/src/components/LoggedInUser.tsx b/packages/desktop-client/src/components/LoggedInUser.tsxindex 0c0662d385..0e715c5a10 100644--- a/packages/desktop-client/src/components/LoggedInUser.tsx+++ b/packages/desktop-client/src/components/LoggedInUser.tsx@@ -1,10 +1,8 @@import React, { useState, useEffect, useRef, type CSSProperties } from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch, useSelector } from 'react-redux';import { useLocation } from 'react-router-dom';import { closeBudget, getUserData, signOut } from 'loot-core/client/actions';-import { type State } from 'loot-core/src/client/state-types';import { type RemoteFile, type SyncedLocalFile } from 'loot-core/types/file';import { type TransObjectLiteral } from 'loot-core/types/util';@@ -12,6 +10,7 @@ import { useAuth } from '../auth/AuthProvider';import { Permissions } from '../auth/types';import { useMetadataPref } from '../hooks/useMetadataPref';import { useNavigate } from '../hooks/useNavigate';+import { useSelector, useDispatch } from '../redux';import { theme, styles } from '../style';import { Button } from './common/Button2';@@ -36,7 +35,7 @@ export function LoggedInUser({const { t } = useTranslation();const dispatch = useDispatch();const navigate = useNavigate();- const userData = useSelector((state: State) => state.user.data);+ const userData = useSelector(state => state.user.data);const [loading, setLoading] = useState(true);const [menuOpen, setMenuOpen] = useState(false);const serverUrl = useServerURL();@@ -51,7 +50,7 @@ export function LoggedInUser({f => f.state === 'remote' || f.state === 'synced' || f.state === 'detached',) as (SyncedLocalFile | RemoteFile)[];const currentFile = remoteFiles.find(f => f.cloudFileId === cloudFileId);- const hasSyncedPrefs = useSelector((state: State) => state.prefs.synced);+ const hasSyncedPrefs = useSelector(state => state.prefs.synced);useEffect(() => {async function init() {diff --git a/packages/desktop-client/src/components/ManageRules.tsx b/packages/desktop-client/src/components/ManageRules.tsxindex 36643423ba..7f3b27e9b8 100644--- a/packages/desktop-client/src/components/ManageRules.tsx+++ b/packages/desktop-client/src/components/ManageRules.tsx@@ -8,7 +8,6 @@ import React, {type Dispatch,} from 'react';import { useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { useSchedules } from 'loot-core/client/data-hooks/schedules';import { q } from 'loot-core/shared/query';@@ -25,6 +24,7 @@ import { useAccounts } from '../hooks/useAccounts';import { useCategories } from '../hooks/useCategories';import { usePayees } from '../hooks/usePayees';import { useSelected, SelectedProvider } from '../hooks/useSelected';+import { useDispatch } from '../redux';import { theme } from '../style';import { Button } from './common/Button2';diff --git a/packages/desktop-client/src/components/Modals.tsx b/packages/desktop-client/src/components/Modals.tsxindex 013d4672fe..4b4919cfbf 100644--- a/packages/desktop-client/src/components/Modals.tsx+++ b/packages/desktop-client/src/components/Modals.tsx@@ -1,7 +1,6 @@// @ts-strict-ignoreimport React, { useEffect } from 'react';import { useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { useLocation } from 'react-router-dom';import { closeModal } from 'loot-core/client/actions';@@ -10,6 +9,7 @@ import * as monthUtils from 'loot-core/src/shared/months';import { useMetadataPref } from '../hooks/useMetadataPref';import { useModalState } from '../hooks/useModalState';+import { useDispatch } from '../redux';import { ModalTitle, ModalHeader } from './common/Modal';import { AccountAutocompleteModal } from './modals/AccountAutocompleteModal';diff --git a/packages/desktop-client/src/components/Notifications.tsx b/packages/desktop-client/src/components/Notifications.tsxindex 59bd7adcb7..dde728d7d9 100644--- a/packages/desktop-client/src/components/Notifications.tsx+++ b/packages/desktop-client/src/components/Notifications.tsx@@ -7,16 +7,15 @@ import React, {type CSSProperties,} from 'react';import { useTranslation } from 'react-i18next';-import { useDispatch, useSelector } from 'react-redux';import { css } from '@emotion/css';import { removeNotification } from 'loot-core/client/actions';-import { type State } from 'loot-core/src/client/state-types';import type { NotificationWithId } from 'loot-core/src/client/state-types/notifications';import { AnimatedLoading } from '../icons/AnimatedLoading';import { SvgDelete } from '../icons/v0';+import { useSelector, useDispatch } from '../redux';import { styles, theme } from '../style';import { Button, ButtonWithLoading } from './common/Button2';@@ -265,12 +264,8 @@ function Notification({export function Notifications({ style }: { style?: CSSProperties }) {const dispatch = useDispatch();const { isNarrowWidth } = useResponsive();- const notifications = useSelector(- (state: State) => state.notifications.notifications,- );- const notificationInset = useSelector(- (state: State) => state.notifications.inset,- );+ const notifications = useSelector(state => state.notifications.notifications);+ const notificationInset = useSelector(state => state.notifications.inset);return (<Viewstyle={{diff --git a/packages/desktop-client/src/components/Titlebar.tsx b/packages/desktop-client/src/components/Titlebar.tsxindex 748c29de9f..c20ae56d6f 100644--- a/packages/desktop-client/src/components/Titlebar.tsx+++ b/packages/desktop-client/src/components/Titlebar.tsx@@ -1,7 +1,6 @@import React, { useState, useEffect, type CSSProperties } from 'react';import { useHotkeys } from 'react-hotkeys-hook';import { useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { Routes, Route, useLocation } from 'react-router-dom';import { css } from '@emotion/css';@@ -26,6 +25,7 @@ import {SvgViewHide,SvgViewShow,} from '../icons/v2';+import { useDispatch } from '../redux';import { theme, styles } from '../style';import { AccountSyncCheck } from './accounts/AccountSyncCheck';diff --git a/packages/desktop-client/src/components/UpdateNotification.tsx b/packages/desktop-client/src/components/UpdateNotification.tsxindex 809ff79781..469b76b98b 100644--- a/packages/desktop-client/src/components/UpdateNotification.tsx+++ b/packages/desktop-client/src/components/UpdateNotification.tsx@@ -1,11 +1,10 @@import React from 'react';import { useTranslation } from 'react-i18next';-import { useSelector, useDispatch } from 'react-redux';import { setAppState, updateApp } from 'loot-core/client/actions';-import { type State } from 'loot-core/src/client/state-types';import { SvgClose } from '../icons/v1';+import { useSelector, useDispatch } from '../redux';import { theme } from '../style';import { Button } from './common/Button2';@@ -15,9 +14,9 @@ import { View } from './common/View';export function UpdateNotification() {const { t } = useTranslation();- const updateInfo = useSelector((state: State) => state.app.updateInfo);+ const updateInfo = useSelector(state => state.app.updateInfo);const showUpdateNotification = useSelector(- (state: State) => state.app.showUpdateNotification,+ state => state.app.showUpdateNotification,);const dispatch = useDispatch();diff --git a/packages/desktop-client/src/components/accounts/Account.tsx b/packages/desktop-client/src/components/accounts/Account.tsxindex 4be9f28866..4ef75e8289 100644--- a/packages/desktop-client/src/components/accounts/Account.tsx+++ b/packages/desktop-client/src/components/accounts/Account.tsx@@ -8,7 +8,6 @@ import React, {useEffect,} from 'react';import { Trans } from 'react-i18next';-import { useSelector } from 'react-redux';import { Navigate, useParams, useLocation } from 'react-router-dom';import { debounce } from 'debounce';@@ -29,6 +28,7 @@ import {type PagedQuery,} from 'loot-core/src/client/query-helpers';import { send, listen } from 'loot-core/src/platform/client/fetch';+import * as undo from 'loot-core/src/platform/client/undo';import { currentDay } from 'loot-core/src/shared/months';import { q, type Query } from 'loot-core/src/shared/query';import {@@ -68,6 +68,7 @@ import {} from '../../hooks/useSplitsExpanded';import { useSyncedPref } from '../../hooks/useSyncedPref';import { useTransactionBatchActions } from '../../hooks/useTransactionBatchActions';+import { useSelector } from '../../redux';import { styles, theme } from '../../style';import { Button } from '../common/Button2';import { Text } from '../common/Text';@@ -261,8 +262,6 @@ type AccountInternalProps = {showExtraBalances?: boolean;setShowExtraBalances: (newValue: boolean) => void;modalShowing?: boolean;- setLastUndoState: (state: null) => void;- lastUndoState: { current: UndoState | null };accounts: AccountEntity[];getPayees: () => Promise<PayeeEntity[]>;updateAccount: (newAccount: AccountEntity) => void;@@ -412,7 +411,7 @@ class AccountInternal extends PureComponent<}}- this.props.setLastUndoState(null);+ undo.setUndoState('undoEvent', null);};const unlistens = [listen('undo-event', onUndo)];@@ -428,8 +427,9 @@ class AccountInternal extends PureComponent<// If there is a pending undo, apply it immediately (this happens// when an undo changes the location to this page)- if (this.props.lastUndoState && this.props.lastUndoState.current) {- onUndo(this.props.lastUndoState.current);+ const lastUndoEvent = undo.getUndoState('undoEvent');+ if (lastUndoEvent) {+ onUndo(lastUndoEvent);}}@@ -1884,7 +1884,6 @@ export function Account() {);const modalShowing = useSelector(state => state.modals.modalStack.length > 0);const accountsSyncing = useSelector(state => state.account.accountsSyncing);- const lastUndoState = useSelector(state => state.app.lastUndoState);const filterConditions = location?.state?.filterConditions || [];const savedFiters = useFilters();@@ -1923,7 +1922,6 @@ export function Account() {payees={payees}modalShowing={modalShowing}accountsSyncing={accountsSyncing}- lastUndoState={lastUndoState}filterConditions={filterConditions}categoryGroups={categoryGroups}{...actionCreators}diff --git a/packages/desktop-client/src/components/accounts/AccountSyncCheck.tsx b/packages/desktop-client/src/components/accounts/AccountSyncCheck.tsxindex 489b6e92e1..f7ec29db71 100644--- a/packages/desktop-client/src/components/accounts/AccountSyncCheck.tsx+++ b/packages/desktop-client/src/components/accounts/AccountSyncCheck.tsx@@ -1,6 +1,5 @@import React, { useCallback, useRef, useState } from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch, useSelector } from 'react-redux';import { useParams } from 'react-router-dom';import { unlinkAccount } from 'loot-core/client/actions';@@ -8,7 +7,9 @@ import { type AccountEntity } from 'loot-core/types/models';import { authorizeBank } from '../../gocardless';import { useAccounts } from '../../hooks/useAccounts';+import { useFailedAccounts } from '../../hooks/useFailedAccounts';import { SvgExclamationOutline } from '../../icons/v1';+import { useDispatch } from '../../redux';import { theme } from '../../style';import { Button } from '../common/Button2';import { Link } from '../common/Link';@@ -82,7 +83,7 @@ function useErrorMessage() {export function AccountSyncCheck() {const accounts = useAccounts();- const failedAccounts = useSelector(state => state.account.failedAccounts);+ const failedAccounts = useFailedAccounts();const dispatch = useDispatch();const { id } = useParams();const [open, setOpen] = useState(false);diff --git a/packages/desktop-client/src/components/autocomplete/PayeeAutocomplete.test.tsx b/packages/desktop-client/src/components/autocomplete/PayeeAutocomplete.test.tsxindex cd9f20a122..b5b3aa925e 100644--- a/packages/desktop-client/src/components/autocomplete/PayeeAutocomplete.test.tsx+++ b/packages/desktop-client/src/components/autocomplete/PayeeAutocomplete.test.tsx@@ -3,11 +3,11 @@ import userEvent from '@testing-library/user-event';import { vi } from 'vitest';import { generateAccount } from 'loot-core/src/mocks';-import { TestProvider } from 'loot-core/src/mocks/redux';import type { AccountEntity, PayeeEntity } from 'loot-core/types/models';import { AuthProvider } from '../../auth/AuthProvider';import { useCommonPayees } from '../../hooks/usePayees';+import { TestProvider } from '../../redux/mock';import { ResponsiveProvider } from '../responsive/ResponsiveProvider';import {diff --git a/packages/desktop-client/src/components/autocomplete/PayeeAutocomplete.tsx b/packages/desktop-client/src/components/autocomplete/PayeeAutocomplete.tsxindex b1f02818a4..997219bb47 100644--- a/packages/desktop-client/src/components/autocomplete/PayeeAutocomplete.tsx+++ b/packages/desktop-client/src/components/autocomplete/PayeeAutocomplete.tsx@@ -12,7 +12,6 @@ import React, {type CSSProperties,} from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { css, cx } from '@emotion/css';@@ -27,6 +26,7 @@ import {import { useAccounts } from '../../hooks/useAccounts';import { useCommonPayees, usePayees } from '../../hooks/usePayees';import { SvgAdd, SvgBookmark } from '../../icons/v1';+import { useDispatch } from '../../redux';import { theme, styles } from '../../style';import { Button } from '../common/Button';import { TextOneLine } from '../common/TextOneLine';diff --git a/packages/desktop-client/src/components/budget/index.tsx b/packages/desktop-client/src/components/budget/index.tsxindex 0012f46f0a..f7b6107044 100644--- a/packages/desktop-client/src/components/budget/index.tsx+++ b/packages/desktop-client/src/components/budget/index.tsx@@ -1,7 +1,6 @@// @ts-strict-ignoreimport React, { memo, useMemo, useState, useEffect } from 'react';import { useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import {addNotification,@@ -26,6 +25,7 @@ import { useGlobalPref } from '../../hooks/useGlobalPref';import { useLocalPref } from '../../hooks/useLocalPref';import { useNavigate } from '../../hooks/useNavigate';import { useSyncedPref } from '../../hooks/useSyncedPref';+import { useDispatch } from '../../redux';import { styles } from '../../style';import { View } from '../common/View';import { NamespaceContext } from '../spreadsheet/NamespaceContext';diff --git a/packages/desktop-client/src/components/manager/BudgetList.tsx b/packages/desktop-client/src/components/manager/BudgetList.tsxindex 03b8ab1300..860a4db0c7 100644--- a/packages/desktop-client/src/components/manager/BudgetList.tsx+++ b/packages/desktop-client/src/components/manager/BudgetList.tsx@@ -6,7 +6,6 @@ import React, {useCallback,} from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch, useSelector } from 'react-redux';import {closeAndDownloadBudget,@@ -43,6 +42,7 @@ import {SvgUserGroup,} from '../../icons/v1';import { SvgCloudUnknown, SvgKey, SvgRefreshArrow } from '../../icons/v2';+import { useSelector, useDispatch } from '../../redux';import { styles, theme } from '../../style';import { tokens } from '../../tokens';import { Button } from '../common/Button2';diff --git a/packages/desktop-client/src/components/manager/ConfigServer.tsx b/packages/desktop-client/src/components/manager/ConfigServer.tsxindex 09511e249e..a8020f083d 100644--- a/packages/desktop-client/src/components/manager/ConfigServer.tsx+++ b/packages/desktop-client/src/components/manager/ConfigServer.tsx@@ -1,7 +1,6 @@// @ts-strict-ignoreimport React, { useState, useEffect, useCallback } from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { createBudget, loggedIn, signOut } from 'loot-core/client/actions';import {@@ -11,6 +10,7 @@ import {import { useGlobalPref } from '../../hooks/useGlobalPref';import { useNavigate } from '../../hooks/useNavigate';+import { useDispatch } from '../../redux';import { theme } from '../../style';import { Button, ButtonWithLoading } from '../common/Button2';import { BigInput } from '../common/Input';diff --git a/packages/desktop-client/src/components/manager/ManagementApp.tsx b/packages/desktop-client/src/components/manager/ManagementApp.tsxindex 05f22b26dd..872bf98363 100644--- a/packages/desktop-client/src/components/manager/ManagementApp.tsx+++ b/packages/desktop-client/src/components/manager/ManagementApp.tsx@@ -1,5 +1,4 @@import React, { useEffect } from 'react';-import { useDispatch, useSelector } from 'react-redux';import { Navigate, Route, Routes } from 'react-router-dom';import { loggedIn, setAppState } from 'loot-core/client/actions';@@ -7,6 +6,7 @@ import { loggedIn, setAppState } from 'loot-core/client/actions';import { ProtectedRoute } from '../../auth/ProtectedRoute';import { Permissions } from '../../auth/types';import { useMetaThemeColor } from '../../hooks/useMetaThemeColor';+import { useSelector, useDispatch } from '../../redux';import { theme } from '../../style';import { tokens } from '../../tokens';import {diff --git a/packages/desktop-client/src/components/manager/WelcomeScreen.tsx b/packages/desktop-client/src/components/manager/WelcomeScreen.tsxindex 9866f16d32..7586402a78 100644--- a/packages/desktop-client/src/components/manager/WelcomeScreen.tsx+++ b/packages/desktop-client/src/components/manager/WelcomeScreen.tsx@@ -1,9 +1,9 @@import React from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { createBudget, pushModal } from 'loot-core/client/actions';+import { useDispatch } from '../../redux';import { styles, theme } from '../../style';import { Button } from '../common/Button2';import { Link } from '../common/Link';diff --git a/packages/desktop-client/src/components/manager/subscribe/Bootstrap.tsx b/packages/desktop-client/src/components/manager/subscribe/Bootstrap.tsxindex 3e2d48b199..d78561dbfd 100644--- a/packages/desktop-client/src/components/manager/subscribe/Bootstrap.tsx+++ b/packages/desktop-client/src/components/manager/subscribe/Bootstrap.tsx@@ -1,12 +1,12 @@// @ts-strict-ignoreimport React, { useState } from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { createBudget } from 'loot-core/src/client/actions/budgets';import { send } from 'loot-core/src/platform/client/fetch';import { useNavigate } from '../../../hooks/useNavigate';+import { useDispatch } from '../../../redux';import { theme } from '../../../style';import { Button } from '../../common/Button2';import { Link } from '../../common/Link';diff --git a/packages/desktop-client/src/components/manager/subscribe/Login.tsx b/packages/desktop-client/src/components/manager/subscribe/Login.tsxindex df8aefaf42..b9f117fd64 100644--- a/packages/desktop-client/src/components/manager/subscribe/Login.tsx+++ b/packages/desktop-client/src/components/manager/subscribe/Login.tsx@@ -1,7 +1,6 @@// @ts-strict-ignoreimport React, { useState, useEffect } from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { useSearchParams } from 'react-router-dom';import { isElectron } from 'loot-core/shared/environment';@@ -11,6 +10,7 @@ import { type OpenIdConfig } from 'loot-core/types/models/openid';import { useNavigate } from '../../../hooks/useNavigate';import { AnimatedLoading } from '../../../icons/AnimatedLoading';+import { useDispatch } from '../../../redux';import { styles, theme } from '../../../style';import { Button, ButtonWithLoading } from '../../common/Button2';import { BigInput } from '../../common/Input';diff --git a/packages/desktop-client/src/components/manager/subscribe/OpenIdCallback.ts b/packages/desktop-client/src/components/manager/subscribe/OpenIdCallback.tsindex 02928047ea..a14871a035 100644--- a/packages/desktop-client/src/components/manager/subscribe/OpenIdCallback.ts+++ b/packages/desktop-client/src/components/manager/subscribe/OpenIdCallback.ts@@ -1,9 +1,10 @@import { useEffect } from 'react';-import { useDispatch } from 'react-redux';import { loggedIn } from 'loot-core/src/client/actions/user';import { send } from 'loot-core/src/platform/client/fetch';+import { useDispatch } from '../../../redux';+export function OpenIdCallback() {const dispatch = useDispatch();useEffect(() => {diff --git a/packages/desktop-client/src/components/mobile/accounts/AccountTransactions.tsx b/packages/desktop-client/src/components/mobile/accounts/AccountTransactions.tsxindex 3b6c678031..50d2456a46 100644--- a/packages/desktop-client/src/components/mobile/accounts/AccountTransactions.tsx+++ b/packages/desktop-client/src/components/mobile/accounts/AccountTransactions.tsx@@ -5,7 +5,6 @@ import React, {useMemo,useState,} from 'react';-import { useDispatch, useSelector } from 'react-redux';import {collapseModals,@@ -38,6 +37,7 @@ import { useAccountPreviewTransactions } from '../../../hooks/useAccountPreviewTimport { useDateFormat } from '../../../hooks/useDateFormat';import { useFailedAccounts } from '../../../hooks/useFailedAccounts';import { useNavigate } from '../../../hooks/useNavigate';+import { useSelector, useDispatch } from '../../../redux';import { styles, theme } from '../../../style';import { Button } from '../../common/Button2';import { Text } from '../../common/Text';diff --git a/packages/desktop-client/src/components/mobile/accounts/Accounts.tsx b/packages/desktop-client/src/components/mobile/accounts/Accounts.tsxindex 3a2668004c..16cb2f958d 100644--- a/packages/desktop-client/src/components/mobile/accounts/Accounts.tsx+++ b/packages/desktop-client/src/components/mobile/accounts/Accounts.tsx@@ -1,6 +1,5 @@import React, { type CSSProperties, useCallback } from 'react';import { useTranslation } from 'react-i18next';-import { useDispatch, useSelector } from 'react-redux';import { css } from '@emotion/css';@@ -13,6 +12,7 @@ import { useFailedAccounts } from '../../../hooks/useFailedAccounts';import { useNavigate } from '../../../hooks/useNavigate';import { useSyncedPref } from '../../../hooks/useSyncedPref';import { SvgAdd, SvgCheveronRight } from '../../../icons/v1';+import { useDispatch, useSelector } from '../../../redux';import { theme, styles } from '../../../style';import { makeAmountFullStyle } from '../../budget/util';import { Button } from '../../common/Button2';diff --git a/packages/desktop-client/src/components/mobile/budget/BudgetTable.jsx b/packages/desktop-client/src/components/mobile/budget/BudgetTable.jsxindex c2bf9cd50b..c3976b3910 100644--- a/packages/desktop-client/src/components/mobile/budget/BudgetTable.jsx+++ b/packages/desktop-client/src/components/mobile/budget/BudgetTable.jsx@@ -1,6 +1,5 @@import React, { memo, useCallback, useRef } from 'react';import { useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { css } from '@emotion/css';import { AutoTextSize } from 'auto-text-size';@@ -31,6 +30,7 @@ import {SvgCheveronRight,} from '../../../icons/v1';import { SvgViewShow } from '../../../icons/v2';+import { useDispatch } from '../../../redux';import { theme, styles } from '../../../style';import { BalanceWithCarryover } from '../../budget/BalanceWithCarryover';import { makeAmountGrey, makeBalanceAmountStyle } from '../../budget/util';diff --git a/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsx b/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsxindex 4eee5f6e2c..290f8c25fa 100644--- a/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsx+++ b/packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsx@@ -1,5 +1,4 @@import React, { useCallback, useEffect, useState } from 'react';-import { useDispatch } from 'react-redux';import { getPayees } from 'loot-core/client/actions';import {@@ -18,6 +17,7 @@ import {import { useDateFormat } from '../../../hooks/useDateFormat';import { useNavigate } from '../../../hooks/useNavigate';+import { useDispatch } from '../../../redux';import { TextOneLine } from '../../common/TextOneLine';import { View } from '../../common/View';import { MobilePageHeader, Page } from '../../Page';diff --git a/packages/desktop-client/src/components/mobile/budget/index.tsx b/packages/desktop-client/src/components/mobile/budget/index.tsxindex 20d233753e..9ff327e885 100644--- a/packages/desktop-client/src/components/mobile/budget/index.tsx+++ b/packages/desktop-client/src/components/mobile/budget/index.tsx@@ -1,6 +1,5 @@// @ts-strict-ignoreimport React, { useCallback, useEffect, useState } from 'react';-import { useDispatch } from 'react-redux';import {applyBudgetAction,@@ -25,6 +24,7 @@ import { useCategories } from '../../../hooks/useCategories';import { useLocalPref } from '../../../hooks/useLocalPref';import { useSyncedPref } from '../../../hooks/useSyncedPref';import { AnimatedLoading } from '../../../icons/AnimatedLoading';+import { useDispatch } from '../../../redux';import { theme } from '../../../style';import { prewarmMonth } from '../../budget/util';import { View } from '../../common/View';diff --git a/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx b/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsxindex 3e0abc5489..ef3066469e 100644--- a/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx+++ b/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx@@ -8,7 +8,6 @@ import React, {useCallback,} from 'react';import { useTranslation } from 'react-i18next';-import { useDispatch, useSelector } from 'react-redux';import { useLocation, useParams } from 'react-router-dom';import {@@ -55,6 +54,7 @@ import {import { SvgSplit } from '../../../icons/v0';import { SvgAdd, SvgPiggyBank, SvgTrash } from '../../../icons/v1';import { SvgPencilWriteAlternate } from '../../../icons/v2';+import { useSelector, useDispatch } from '../../../redux';import { styles, theme } from '../../../style';import { Button } from '../../common/Button';import { Text } from '../../common/Text';diff --git a/packages/desktop-client/src/components/mobile/transactions/TransactionList.jsx b/packages/desktop-client/src/components/mobile/transactions/TransactionList.jsxindex f577126fdb..cf555dba3b 100644--- a/packages/desktop-client/src/components/mobile/transactions/TransactionList.jsx+++ b/packages/desktop-client/src/components/mobile/transactions/TransactionList.jsx@@ -7,7 +7,6 @@ import React, {} from 'react';import { ListBox, Section, Header, Collection } from 'react-aria-components';import { useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { setNotificationInset } from 'loot-core/client/actions';import { groupById, integerToCurrency } from 'loot-core/shared/util';@@ -27,6 +26,7 @@ import { useUndo } from '../../../hooks/useUndo';import { AnimatedLoading } from '../../../icons/AnimatedLoading';import { SvgDelete } from '../../../icons/v0';import { SvgDotsHorizontalTriple } from '../../../icons/v1';+import { useDispatch } from '../../../redux';import { styles, theme } from '../../../style';import { Button } from '../../common/Button2';import { Menu } from '../../common/Menu';diff --git a/packages/desktop-client/src/components/mobile/transactions/TransactionListItem.tsx b/packages/desktop-client/src/components/mobile/transactions/TransactionListItem.tsxindex db898ec9ef..dee30eddf0 100644--- a/packages/desktop-client/src/components/mobile/transactions/TransactionListItem.tsx+++ b/packages/desktop-client/src/components/mobile/transactions/TransactionListItem.tsx@@ -4,7 +4,6 @@ import React, {} from 'react';import { mergeProps } from 'react-aria';import { ListBoxItem } from 'react-aria-components';-import { useSelector } from 'react-redux';import {PressResponder,@@ -25,6 +24,7 @@ import {SvgCheckCircle1,SvgLockClosed,} from '../../../icons/v2';+import { useSelector } from '../../../redux';import { styles, theme } from '../../../style';import { makeAmountFullStyle } from '../../budget/util';import { Button } from '../../common/Button2';diff --git a/packages/desktop-client/src/components/modals/BudgetListModal.tsx b/packages/desktop-client/src/components/modals/BudgetListModal.tsxindex 10e4e5e582..1d1d5fc77f 100644--- a/packages/desktop-client/src/components/modals/BudgetListModal.tsx+++ b/packages/desktop-client/src/components/modals/BudgetListModal.tsx@@ -1,8 +1,8 @@import React from 'react';import { useTranslation } from 'react-i18next';-import { useSelector } from 'react-redux';import { useMetadataPref } from '../../hooks/useMetadataPref';+import { useSelector } from '../../redux';import { Modal, ModalHeader, ModalCloseButton } from '../common/Modal';import { Text } from '../common/Text';import { View } from '../common/View';diff --git a/packages/desktop-client/src/components/modals/CloseAccountModal.tsx b/packages/desktop-client/src/components/modals/CloseAccountModal.tsxindex 2b476bd37d..98a606bc0a 100644--- a/packages/desktop-client/src/components/modals/CloseAccountModal.tsx+++ b/packages/desktop-client/src/components/modals/CloseAccountModal.tsx@@ -2,7 +2,6 @@import React, { type FormEvent, useState, type CSSProperties } from 'react';import { Form } from 'react-aria-components';import { useTranslation, Trans } from 'react-i18next';-import { useDispatch } from 'react-redux';import {closeAccount,@@ -15,6 +14,7 @@ import { type TransObjectLiteral } from 'loot-core/types/util';import { useAccounts } from '../../hooks/useAccounts';import { useCategories } from '../../hooks/useCategories';+import { useDispatch } from '../../redux';import { styles, theme } from '../../style';import { AccountAutocomplete } from '../autocomplete/AccountAutocomplete';import { CategoryAutocomplete } from '../autocomplete/CategoryAutocomplete';diff --git a/packages/desktop-client/src/components/modals/CoverModal.tsx b/packages/desktop-client/src/components/modals/CoverModal.tsxindex 30a94eb76f..8123d80f8f 100644--- a/packages/desktop-client/src/components/modals/CoverModal.tsx+++ b/packages/desktop-client/src/components/modals/CoverModal.tsx@@ -1,11 +1,11 @@import React, { useCallback, useMemo, useState } from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { pushModal } from 'loot-core/client/actions';import { type CategoryEntity } from 'loot-core/src/types/models';import { useCategories } from '../../hooks/useCategories';+import { useDispatch } from '../../redux';import { styles } from '../../style';import {addToBeBudgetedGroup,diff --git a/packages/desktop-client/src/components/modals/CreateAccountModal.tsx b/packages/desktop-client/src/components/modals/CreateAccountModal.tsxindex 85d438a65f..64597e2a00 100644--- a/packages/desktop-client/src/components/modals/CreateAccountModal.tsx+++ b/packages/desktop-client/src/components/modals/CreateAccountModal.tsx@@ -1,7 +1,6 @@import React, { useEffect, useState } from 'react';import { DialogTrigger } from 'react-aria-components';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { pushModal } from 'loot-core/client/actions';import { send } from 'loot-core/src/platform/client/fetch';@@ -13,6 +12,7 @@ import { useGoCardlessStatus } from '../../hooks/useGoCardlessStatus';import { useSimpleFinStatus } from '../../hooks/useSimpleFinStatus';import { useSyncServerStatus } from '../../hooks/useSyncServerStatus';import { SvgDotsHorizontalTriple } from '../../icons/v1';+import { useDispatch } from '../../redux';import { theme } from '../../style';import { Warning } from '../alerts';import { Button, ButtonWithLoading } from '../common/Button2';diff --git a/packages/desktop-client/src/components/modals/CreateEncryptionKeyModal.tsx b/packages/desktop-client/src/components/modals/CreateEncryptionKeyModal.tsxindex 77ec1b9eb7..1e9c3bbcba 100644--- a/packages/desktop-client/src/components/modals/CreateEncryptionKeyModal.tsx+++ b/packages/desktop-client/src/components/modals/CreateEncryptionKeyModal.tsx@@ -2,7 +2,6 @@import React, { useState } from 'react';import { Form } from 'react-aria-components';import { useTranslation, Trans } from 'react-i18next';-import { useDispatch } from 'react-redux';import { css } from '@emotion/css';@@ -10,6 +9,7 @@ import { loadAllFiles, loadGlobalPrefs, sync } from 'loot-core/client/actions';import { send } from 'loot-core/src/platform/client/fetch';import { getCreateKeyError } from 'loot-core/src/shared/errors';+import { useDispatch } from '../../redux';import { styles, theme } from '../../style';import { ButtonWithLoading } from '../common/Button2';import { InitialFocus } from '../common/InitialFocus';diff --git a/packages/desktop-client/src/components/modals/CreateLocalAccountModal.tsx b/packages/desktop-client/src/components/modals/CreateLocalAccountModal.tsxindex d2147150b8..72e2e38619 100644--- a/packages/desktop-client/src/components/modals/CreateLocalAccountModal.tsx+++ b/packages/desktop-client/src/components/modals/CreateLocalAccountModal.tsx@@ -2,13 +2,13 @@import { type FormEvent, useState } from 'react';import { Form } from 'react-aria-components';import { useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { closeModal, createAccount } from 'loot-core/client/actions';import { toRelaxedNumber } from 'loot-core/src/shared/util';import * as useAccounts from '../../hooks/useAccounts';import { useNavigate } from '../../hooks/useNavigate';+import { useDispatch } from '../../redux';import { theme } from '../../style';import { Button } from '../common/Button2';import { FormError } from '../common/FormError';diff --git a/packages/desktop-client/src/components/modals/EditRuleModal.jsx b/packages/desktop-client/src/components/modals/EditRuleModal.jsxindex 78599bb261..f70aae8709 100644--- a/packages/desktop-client/src/components/modals/EditRuleModal.jsx+++ b/packages/desktop-client/src/components/modals/EditRuleModal.jsx@@ -1,6 +1,5 @@import React, { useState, useEffect, useRef, useMemo } from 'react';import { useTranslation, Trans } from 'react-i18next';-import { useDispatch } from 'react-redux';import { css } from '@emotion/css';import { v4 as uuid } from 'uuid';@@ -37,6 +36,7 @@ import { useFeatureFlag } from '../../hooks/useFeatureFlag';import { useSelected, SelectedProvider } from '../../hooks/useSelected';import { SvgDelete, SvgAdd, SvgSubtract } from '../../icons/v0';import { SvgAlignLeft, SvgCode, SvgInformationOutline } from '../../icons/v1';+import { useDispatch } from '../../redux';import { styles, theme } from '../../style';import { Button } from '../common/Button2';import { Menu } from '../common/Menu';diff --git a/packages/desktop-client/src/components/modals/EnvelopeBudgetSummaryModal.tsx b/packages/desktop-client/src/components/modals/EnvelopeBudgetSummaryModal.tsxindex 8c9b247da3..b22ed2a457 100644--- a/packages/desktop-client/src/components/modals/EnvelopeBudgetSummaryModal.tsx+++ b/packages/desktop-client/src/components/modals/EnvelopeBudgetSummaryModal.tsx@@ -1,6 +1,5 @@import React from 'react';import { useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { collapseModals, pushModal } from 'loot-core/client/actions';import { envelopeBudget } from 'loot-core/client/queries';@@ -9,6 +8,7 @@ import { format, sheetForMonth, prevMonth } from 'loot-core/src/shared/months';import { useCategories } from '../../hooks/useCategories';import { useUndo } from '../../hooks/useUndo';+import { useDispatch } from '../../redux';import { styles } from '../../style';import { ToBudgetAmount } from '../budget/envelope/budgetsummary/ToBudgetAmount';import { TotalsList } from '../budget/envelope/budgetsummary/TotalsList';diff --git a/packages/desktop-client/src/components/modals/GoCardlessExternalMsgModal.tsx b/packages/desktop-client/src/components/modals/GoCardlessExternalMsgModal.tsxindex 886fff3c88..7d11970381 100644--- a/packages/desktop-client/src/components/modals/GoCardlessExternalMsgModal.tsx+++ b/packages/desktop-client/src/components/modals/GoCardlessExternalMsgModal.tsx@@ -1,7 +1,6 @@// @ts-strict-ignoreimport React, { useEffect, useState, useRef } from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { pushModal } from 'loot-core/src/client/actions/modals';import { sendCatch } from 'loot-core/src/platform/client/fetch';@@ -12,6 +11,7 @@ import {import { useGoCardlessStatus } from '../../hooks/useGoCardlessStatus';import { AnimatedLoading } from '../../icons/AnimatedLoading';+import { useDispatch } from '../../redux';import { theme } from '../../style';import { Error, Warning } from '../alerts';import { Autocomplete } from '../autocomplete/Autocomplete';diff --git a/packages/desktop-client/src/components/modals/ImportTransactionsModal/ImportTransactionsModal.jsx b/packages/desktop-client/src/components/modals/ImportTransactionsModal/ImportTransactionsModal.jsxindex 530b2d1032..9c1092ef96 100644--- a/packages/desktop-client/src/components/modals/ImportTransactionsModal/ImportTransactionsModal.jsx+++ b/packages/desktop-client/src/components/modals/ImportTransactionsModal/ImportTransactionsModal.jsx@@ -1,6 +1,5 @@import React, { useState, useEffect, useCallback } from 'react';import { useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import deepEqual from 'deep-equal';@@ -14,6 +13,7 @@ import { amountToInteger } from 'loot-core/src/shared/util';import { useDateFormat } from '../../../hooks/useDateFormat';import { useSyncedPrefs } from '../../../hooks/useSyncedPrefs';+import { useDispatch } from '../../../redux';import { theme } from '../../../style';import { Button, ButtonWithLoading } from '../../common/Button2';import { Input } from '../../common/Input';diff --git a/packages/desktop-client/src/components/modals/LoadBackupModal.tsx b/packages/desktop-client/src/components/modals/LoadBackupModal.tsxindex 0be83b372c..19bbb62fac 100644--- a/packages/desktop-client/src/components/modals/LoadBackupModal.tsx+++ b/packages/desktop-client/src/components/modals/LoadBackupModal.tsx@@ -1,12 +1,12 @@import React, { useState, useEffect } from 'react';import { useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { loadBackup, makeBackup } from 'loot-core/client/actions';import { type Backup } from 'loot-core/server/backups';import { send, listen, unlisten } from 'loot-core/src/platform/client/fetch';import { useMetadataPref } from '../../hooks/useMetadataPref';+import { useDispatch } from '../../redux';import { theme } from '../../style';import { Block } from '../common/Block';import { Button } from '../common/Button2';diff --git a/packages/desktop-client/src/components/modals/MergeUnusedPayeesModal.tsx b/packages/desktop-client/src/components/modals/MergeUnusedPayeesModal.tsxindex acd5ae9b38..4a22fbfefd 100644--- a/packages/desktop-client/src/components/modals/MergeUnusedPayeesModal.tsx+++ b/packages/desktop-client/src/components/modals/MergeUnusedPayeesModal.tsx@@ -1,12 +1,12 @@import React, { useState, useRef, useEffect, useCallback } from 'react';import { useTranslation } from 'react-i18next';-import { useDispatch, useSelector } from 'react-redux';import { replaceModal } from 'loot-core/src/client/actions/modals';import { send } from 'loot-core/src/platform/client/fetch';import { type PayeeEntity } from 'loot-core/types/models';import { usePayees } from '../../hooks/usePayees';+import { useSelector, useDispatch } from '../../redux';import { theme } from '../../style';import { Information } from '../alerts';import { Button } from '../common/Button2';diff --git a/packages/desktop-client/src/components/modals/OutOfSyncMigrationsModal.tsx b/packages/desktop-client/src/components/modals/OutOfSyncMigrationsModal.tsxindex 60bd9fc054..2a904f2634 100644--- a/packages/desktop-client/src/components/modals/OutOfSyncMigrationsModal.tsx+++ b/packages/desktop-client/src/components/modals/OutOfSyncMigrationsModal.tsx@@ -1,9 +1,9 @@import React from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { closeBudget } from 'loot-core/client/actions';+import { useDispatch } from '../../redux';import { Button } from '../common/Button2';import { Link } from '../common/Link';import { Modal, ModalHeader, ModalTitle } from '../common/Modal';diff --git a/packages/desktop-client/src/components/modals/SelectLinkedAccountsModal.jsx b/packages/desktop-client/src/components/modals/SelectLinkedAccountsModal.jsxindex 98eaf9a883..d72bd8e8cf 100644--- a/packages/desktop-client/src/components/modals/SelectLinkedAccountsModal.jsx+++ b/packages/desktop-client/src/components/modals/SelectLinkedAccountsModal.jsx@@ -1,6 +1,5 @@import React, { useState } from 'react';import { useTranslation, Trans } from 'react-i18next';-import { useDispatch } from 'react-redux';import {closeModal,@@ -10,6 +9,7 @@ import {} from 'loot-core/client/actions';import { useAccounts } from '../../hooks/useAccounts';+import { useDispatch } from '../../redux';import { theme } from '../../style';import { Autocomplete } from '../autocomplete/Autocomplete';import { Button } from '../common/Button2';diff --git a/packages/desktop-client/src/components/modals/TransferModal.tsx b/packages/desktop-client/src/components/modals/TransferModal.tsxindex 2abd515a61..9cf1a7fa64 100644--- a/packages/desktop-client/src/components/modals/TransferModal.tsx+++ b/packages/desktop-client/src/components/modals/TransferModal.tsx@@ -1,11 +1,11 @@import React, { useMemo, useState } from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { pushModal } from 'loot-core/client/actions';import { type CategoryEntity } from 'loot-core/types/models';import { useCategories } from '../../hooks/useCategories';+import { useDispatch } from '../../redux';import { styles } from '../../style';import {addToBeBudgetedGroup,diff --git a/packages/desktop-client/src/components/modals/TransferOwnership.tsx b/packages/desktop-client/src/components/modals/TransferOwnership.tsxindex bb2a198c48..d1619964ff 100644--- a/packages/desktop-client/src/components/modals/TransferOwnership.tsx+++ b/packages/desktop-client/src/components/modals/TransferOwnership.tsx@@ -1,9 +1,7 @@import { useEffect, useState } from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch, useSelector } from 'react-redux';import { addNotification, closeAndLoadBudget } from 'loot-core/client/actions';-import { type State } from 'loot-core/client/state-types';import { send } from 'loot-core/platform/client/fetch';import { getUserAccessErrors } from 'loot-core/shared/errors';import { type Budget } from 'loot-core/types/budget';@@ -12,6 +10,7 @@ import { type Handlers } from 'loot-core/types/handlers';import { useActions } from '../../hooks/useActions';import { useMetadataPref } from '../../hooks/useMetadataPref';+import { useDispatch, useSelector } from '../../redux';import { styles, theme } from '../../style';import { Button } from '../common/Button2';import { Modal, ModalCloseButton, ModalHeader } from '../common/Modal';@@ -30,7 +29,7 @@ export function TransferOwnership({}: TransferOwnershipProps) {const { t } = useTranslation();- const userData = useSelector((state: State) => state.user.data);+ const userData = useSelector(state => state.user.data);const actions = useActions();const [userId, setUserId] = useState('');const [error, setError] = useState<string | null>(null);diff --git a/packages/desktop-client/src/components/modals/manager/ConfirmChangeDocumentDir.tsx b/packages/desktop-client/src/components/modals/manager/ConfirmChangeDocumentDir.tsxindex 23e81a4f23..adf3e5dfe3 100644--- a/packages/desktop-client/src/components/modals/manager/ConfirmChangeDocumentDir.tsx+++ b/packages/desktop-client/src/components/modals/manager/ConfirmChangeDocumentDir.tsx@@ -1,10 +1,10 @@import React, { useCallback, useState } from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { addNotification } from 'loot-core/client/actions';import { useGlobalPref } from '../../../hooks/useGlobalPref';+import { useDispatch } from '../../../redux';import { theme, styles } from '../../../style';import { Information } from '../../alerts';import { Button, ButtonWithLoading } from '../../common/Button2';diff --git a/packages/desktop-client/src/components/modals/manager/DeleteFileModal.tsx b/packages/desktop-client/src/components/modals/manager/DeleteFileModal.tsxindex 3b93804fb8..2524c0e4d1 100644--- a/packages/desktop-client/src/components/modals/manager/DeleteFileModal.tsx+++ b/packages/desktop-client/src/components/modals/manager/DeleteFileModal.tsx@@ -1,10 +1,10 @@import React, { useState } from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { deleteBudget } from 'loot-core/client/actions';import { type File } from 'loot-core/src/types/file';+import { useDispatch } from '../../../redux';import { theme } from '../../../style';import { ButtonWithLoading } from '../../common/Button2';import { Modal, ModalCloseButton, ModalHeader } from '../../common/Modal';diff --git a/packages/desktop-client/src/components/modals/manager/DuplicateFileModal.tsx b/packages/desktop-client/src/components/modals/manager/DuplicateFileModal.tsxindex a614b97c6d..224aaa0f08 100644--- a/packages/desktop-client/src/components/modals/manager/DuplicateFileModal.tsx+++ b/packages/desktop-client/src/components/modals/manager/DuplicateFileModal.tsx@@ -1,6 +1,5 @@import React, { useEffect, useState } from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import {addNotification,@@ -10,6 +9,7 @@ import {} from 'loot-core/client/actions';import { type File } from 'loot-core/src/types/file';+import { useDispatch } from '../../../redux';import { theme } from '../../../style';import { Button, ButtonWithLoading } from '../../common/Button2';import { FormError } from '../../common/FormError';diff --git a/packages/desktop-client/src/components/modals/manager/FilesSettingsModal.tsx b/packages/desktop-client/src/components/modals/manager/FilesSettingsModal.tsxindex 55d1e7bee6..ee3c1107de 100644--- a/packages/desktop-client/src/components/modals/manager/FilesSettingsModal.tsx+++ b/packages/desktop-client/src/components/modals/manager/FilesSettingsModal.tsx@@ -1,11 +1,11 @@import React, { useState } from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { loadAllFiles, pushModal } from 'loot-core/client/actions';import { useGlobalPref } from '../../../hooks/useGlobalPref';import { SvgPencil1 } from '../../../icons/v2';+import { useDispatch } from '../../../redux';import { theme, styles } from '../../../style';import { Button } from '../../common/Button2';import { Modal, ModalCloseButton, ModalHeader } from '../../common/Modal';diff --git a/packages/desktop-client/src/components/modals/manager/ImportActualModal.tsx b/packages/desktop-client/src/components/modals/manager/ImportActualModal.tsxindex ac31b5757b..995154b13e 100644--- a/packages/desktop-client/src/components/modals/manager/ImportActualModal.tsx+++ b/packages/desktop-client/src/components/modals/manager/ImportActualModal.tsx@@ -1,11 +1,11 @@// @ts-strict-ignoreimport React, { useState } from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { importBudget } from 'loot-core/src/client/actions/budgets';import { useNavigate } from '../../../hooks/useNavigate';+import { useDispatch } from '../../../redux';import { styles, theme } from '../../../style';import { Block } from '../../common/Block';import { ButtonWithLoading } from '../../common/Button2';diff --git a/packages/desktop-client/src/components/modals/manager/ImportModal.tsx b/packages/desktop-client/src/components/modals/manager/ImportModal.tsxindex 3ced17d709..ef4d1824f0 100644--- a/packages/desktop-client/src/components/modals/manager/ImportModal.tsx+++ b/packages/desktop-client/src/components/modals/manager/ImportModal.tsx@@ -1,9 +1,9 @@import React, { useState } from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { pushModal } from 'loot-core/client/actions';+import { useDispatch } from '../../../redux';import { styles, theme } from '../../../style';import { Block } from '../../common/Block';import { Button } from '../../common/Button2';diff --git a/packages/desktop-client/src/components/modals/manager/ImportYNAB4Modal.tsx b/packages/desktop-client/src/components/modals/manager/ImportYNAB4Modal.tsxindex 2c0a52b931..49a80721bf 100644--- a/packages/desktop-client/src/components/modals/manager/ImportYNAB4Modal.tsx+++ b/packages/desktop-client/src/components/modals/manager/ImportYNAB4Modal.tsx@@ -1,11 +1,11 @@// @ts-strict-ignoreimport React, { useState } from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { importBudget } from 'loot-core/src/client/actions/budgets';import { useNavigate } from '../../../hooks/useNavigate';+import { useDispatch } from '../../../redux';import { styles, theme } from '../../../style';import { Block } from '../../common/Block';import { ButtonWithLoading } from '../../common/Button2';diff --git a/packages/desktop-client/src/components/modals/manager/ImportYNAB5Modal.tsx b/packages/desktop-client/src/components/modals/manager/ImportYNAB5Modal.tsxindex 98ee2f49fa..8945278e80 100644--- a/packages/desktop-client/src/components/modals/manager/ImportYNAB5Modal.tsx+++ b/packages/desktop-client/src/components/modals/manager/ImportYNAB5Modal.tsx@@ -1,11 +1,11 @@// @ts-strict-ignoreimport React, { useState } from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { importBudget } from 'loot-core/src/client/actions/budgets';import { useNavigate } from '../../../hooks/useNavigate';+import { useDispatch } from '../../../redux';import { styles, theme } from '../../../style';import { Block } from '../../common/Block';import { ButtonWithLoading } from '../../common/Button2';diff --git a/packages/desktop-client/src/components/payees/ManagePayeesWithData.tsx b/packages/desktop-client/src/components/payees/ManagePayeesWithData.tsxindex 064023fbad..f7940295f5 100644--- a/packages/desktop-client/src/components/payees/ManagePayeesWithData.tsx+++ b/packages/desktop-client/src/components/payees/ManagePayeesWithData.tsx@@ -1,18 +1,18 @@import React, { useState, useEffect, useCallback } from 'react';-import { useDispatch, useSelector } from 'react-redux';import {getPayees,initiallyLoadPayees,pushModal,- setLastUndoState,} from 'loot-core/client/actions';import { type UndoState } from 'loot-core/server/undo';import { send, listen } from 'loot-core/src/platform/client/fetch';+import * as undo from 'loot-core/src/platform/client/undo';import { applyChanges, type Diff } from 'loot-core/src/shared/util';import { type NewRuleEntity, type PayeeEntity } from 'loot-core/types/models';import { usePayees } from '../../hooks/usePayees';+import { useDispatch } from '../../redux';import { ManagePayees } from './ManagePayees';@@ -24,7 +24,6 @@ export function ManagePayeesWithData({initialSelectedIds,}: ManagePayeesWithDataProps) {const payees = usePayees();- const lastUndoState = useSelector(state => state.app.lastUndoState);const dispatch = useDispatch();const [ruleCounts, setRuleCounts] = useState({ value: new Map() });@@ -80,15 +79,16 @@ export function ManagePayeesWithData({await refetchRuleCounts();}- await dispatch(setLastUndoState(null));+ undo.setUndoState('undoEvent', null);}- if (lastUndoState.current) {- onUndo(lastUndoState.current);+ const lastUndoEvent = undo.getUndoState('undoEvent');+ if (lastUndoEvent) {+ onUndo(lastUndoEvent);}return listen('undo-event', onUndo);- }, [dispatch, lastUndoState, refetchRuleCounts, refetchOrphanedPayees]);+ }, [dispatch, refetchRuleCounts, refetchOrphanedPayees]);function onViewRules(id: PayeeEntity['id']) {dispatch(pushModal('manage-rules', { payeeId: id }));diff --git a/packages/desktop-client/src/components/reports/Overview.tsx b/packages/desktop-client/src/components/reports/Overview.tsxindex 8178454a9b..5c13de11b9 100644--- a/packages/desktop-client/src/components/reports/Overview.tsx+++ b/packages/desktop-client/src/components/reports/Overview.tsx@@ -2,7 +2,6 @@ import React, { useMemo, useRef, useState } from 'react';import { Responsive, WidthProvider, type Layout } from 'react-grid-layout';import { useHotkeys } from 'react-hotkeys-hook';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { useLocation } from 'react-router-dom';import {@@ -22,6 +21,7 @@ import {import { useAccounts } from '../../hooks/useAccounts';import { useNavigate } from '../../hooks/useNavigate';import { useSyncedPref } from '../../hooks/useSyncedPref';+import { useDispatch } from '../../redux';import { breakpoints } from '../../tokens';import { Button } from '../common/Button2';import { Menu } from '../common/Menu';diff --git a/packages/desktop-client/src/components/reports/reports/Calendar.tsx b/packages/desktop-client/src/components/reports/reports/Calendar.tsxindex f064616fbc..d4a723f671 100644--- a/packages/desktop-client/src/components/reports/reports/Calendar.tsx+++ b/packages/desktop-client/src/components/reports/reports/Calendar.tsx@@ -7,7 +7,6 @@ import React, {useCallback,} from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { useParams, useSearchParams } from 'react-router-dom';import { useSpring, animated, config } from 'react-spring';@@ -48,6 +47,7 @@ import {SvgCheveronDown,SvgCheveronUp,} from '../../../icons/v1';+import { useDispatch } from '../../../redux';import { styles, theme } from '../../../style';import { Button } from '../../common/Button2';import { View } from '../../common/View';diff --git a/packages/desktop-client/src/components/reports/reports/CashFlow.tsx b/packages/desktop-client/src/components/reports/reports/CashFlow.tsxindex e7debf2df0..9ec6af671f 100644--- a/packages/desktop-client/src/components/reports/reports/CashFlow.tsx+++ b/packages/desktop-client/src/components/reports/reports/CashFlow.tsx@@ -1,6 +1,5 @@import React, { useState, useEffect, useMemo } from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { useParams } from 'react-router-dom';import * as d from 'date-fns';@@ -18,6 +17,7 @@ import {import { useFilters } from '../../../hooks/useFilters';import { useNavigate } from '../../../hooks/useNavigate';+import { useDispatch } from '../../../redux';import { theme } from '../../../style';import { AlignedText } from '../../common/AlignedText';import { Block } from '../../common/Block';diff --git a/packages/desktop-client/src/components/reports/reports/CustomReportListCards.tsx b/packages/desktop-client/src/components/reports/reports/CustomReportListCards.tsxindex cc0a6e1446..b30a4dd151 100644--- a/packages/desktop-client/src/components/reports/reports/CustomReportListCards.tsx+++ b/packages/desktop-client/src/components/reports/reports/CustomReportListCards.tsx@@ -1,6 +1,5 @@import React, { useEffect, useState } from 'react';import { useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { send, sendCatch } from 'loot-core/platform/client/fetch/index';import { addNotification } from 'loot-core/src/client/actions';@@ -13,6 +12,7 @@ import { useCategories } from '../../../hooks/useCategories';import { usePayees } from '../../../hooks/usePayees';import { useSyncedPref } from '../../../hooks/useSyncedPref';import { SvgExclamationSolid } from '../../../icons/v1';+import { useDispatch } from '../../../redux';import { styles } from '../../../style/index';import { theme } from '../../../style/theme';import { Text } from '../../common/Text';diff --git a/packages/desktop-client/src/components/reports/reports/NetWorth.tsx b/packages/desktop-client/src/components/reports/reports/NetWorth.tsxindex ce0344486f..150436fe1f 100644--- a/packages/desktop-client/src/components/reports/reports/NetWorth.tsx+++ b/packages/desktop-client/src/components/reports/reports/NetWorth.tsx@@ -1,6 +1,5 @@import React, { useState, useEffect, useMemo } from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { useParams } from 'react-router-dom';import * as d from 'date-fns';@@ -15,6 +14,7 @@ import { type TimeFrame, type NetWorthWidget } from 'loot-core/types/models';import { useAccounts } from '../../../hooks/useAccounts';import { useFilters } from '../../../hooks/useFilters';import { useNavigate } from '../../../hooks/useNavigate';+import { useDispatch } from '../../../redux';import { theme, styles } from '../../../style';import { Button } from '../../common/Button2';import { Paragraph } from '../../common/Paragraph';diff --git a/packages/desktop-client/src/components/reports/reports/Spending.tsx b/packages/desktop-client/src/components/reports/reports/Spending.tsxindex d7ae60e8da..a97fc15a2e 100644--- a/packages/desktop-client/src/components/reports/reports/Spending.tsx+++ b/packages/desktop-client/src/components/reports/reports/Spending.tsx@@ -1,6 +1,5 @@import React, { useState, useMemo, useEffect } from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { useParams } from 'react-router-dom';import * as d from 'date-fns';@@ -15,6 +14,7 @@ import { type RuleConditionEntity } from 'loot-core/types/models/rule';import { useFilters } from '../../../hooks/useFilters';import { useNavigate } from '../../../hooks/useNavigate';+import { useDispatch } from '../../../redux';import { theme, styles } from '../../../style';import { AlignedText } from '../../common/AlignedText';import { Block } from '../../common/Block';diff --git a/packages/desktop-client/src/components/reports/reports/Summary.tsx b/packages/desktop-client/src/components/reports/reports/Summary.tsxindex 95be1b5b46..1d7e5200ed 100644--- a/packages/desktop-client/src/components/reports/reports/Summary.tsx+++ b/packages/desktop-client/src/components/reports/reports/Summary.tsx@@ -1,6 +1,5 @@import React, { useState, useEffect, useMemo, type CSSProperties } from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { useParams } from 'react-router-dom';import { parseISO } from 'date-fns';@@ -22,6 +21,7 @@ import { SvgEquals } from '../../../icons/v1';import { SvgCloseParenthesis } from '../../../icons/v2/CloseParenthesis';import { SvgOpenParenthesis } from '../../../icons/v2/OpenParenthesis';import { SvgSum } from '../../../icons/v2/Sum';+import { useDispatch } from '../../../redux';import { theme } from '../../../style';import { Button } from '../../common/Button2';import { Text } from '../../common/Text';diff --git a/packages/desktop-client/src/components/schedules/PostsOfflineNotification.tsx b/packages/desktop-client/src/components/schedules/PostsOfflineNotification.tsxindex 2dd79ea0ef..47e9e70c4f 100644--- a/packages/desktop-client/src/components/schedules/PostsOfflineNotification.tsx+++ b/packages/desktop-client/src/components/schedules/PostsOfflineNotification.tsx@@ -1,6 +1,5 @@import React from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { useLocation } from 'react-router-dom';import { popModal } from 'loot-core/client/actions';@@ -8,6 +7,7 @@ import { send } from 'loot-core/src/platform/client/fetch';import { type PayeeEntity } from 'loot-core/types/models';import { useFormatList } from '../../hooks/useFormatList';+import { useDispatch } from '../../redux';import { theme } from '../../style';import { Button } from '../common/Button2';import { Modal, ModalCloseButton, ModalHeader } from '../common/Modal';diff --git a/packages/desktop-client/src/components/schedules/ScheduleDetails.tsx b/packages/desktop-client/src/components/schedules/ScheduleDetails.tsxindex 6d02f34d1e..bb91735845 100644--- a/packages/desktop-client/src/components/schedules/ScheduleDetails.tsx+++ b/packages/desktop-client/src/components/schedules/ScheduleDetails.tsx@@ -1,7 +1,6 @@// @ts-strict-ignoreimport React, { useEffect, useReducer } from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { t } from 'i18next';@@ -22,6 +21,7 @@ import {import { useDateFormat } from '../../hooks/useDateFormat';import { usePayees } from '../../hooks/usePayees';import { useSelected, SelectedProvider } from '../../hooks/useSelected';+import { useDispatch } from '../../redux';import { theme } from '../../style';import { AccountAutocomplete } from '../autocomplete/AccountAutocomplete';import { PayeeAutocomplete } from '../autocomplete/PayeeAutocomplete';diff --git a/packages/desktop-client/src/components/schedules/ScheduleLink.tsx b/packages/desktop-client/src/components/schedules/ScheduleLink.tsxindex a787fe9fe6..773d460c05 100644--- a/packages/desktop-client/src/components/schedules/ScheduleLink.tsx+++ b/packages/desktop-client/src/components/schedules/ScheduleLink.tsx@@ -1,7 +1,6 @@// @ts-strict-ignoreimport React, { useMemo, useRef, useState } from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { pushModal } from 'loot-core/client/actions';import { useSchedules } from 'loot-core/src/client/data-hooks/schedules';@@ -13,6 +12,7 @@ import {} from 'loot-core/src/types/models';import { SvgAdd } from '../../icons/v0';+import { useDispatch } from '../../redux';import { Button } from '../common/Button2';import { InitialFocus } from '../common/InitialFocus';import { Modal, ModalCloseButton, ModalHeader } from '../common/Modal';diff --git a/packages/desktop-client/src/components/schedules/index.tsx b/packages/desktop-client/src/components/schedules/index.tsxindex 02db32b2a6..e3f39cd1e9 100644--- a/packages/desktop-client/src/components/schedules/index.tsx+++ b/packages/desktop-client/src/components/schedules/index.tsx@@ -1,6 +1,5 @@import React, { useCallback, useMemo, useState } from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { pushModal } from 'loot-core/client/actions';import { q } from 'loot-core/shared/query';@@ -8,6 +7,7 @@ import { useSchedules } from 'loot-core/src/client/data-hooks/schedules';import { send } from 'loot-core/src/platform/client/fetch';import { type ScheduleEntity } from 'loot-core/src/types/models';+import { useDispatch } from '../../redux';import { theme } from '../../style';import { Button } from '../common/Button2';import { Search } from '../common/Search';diff --git a/packages/desktop-client/src/components/settings/AuthSettings.tsx b/packages/desktop-client/src/components/settings/AuthSettings.tsxindex 229a5ed92b..83af5bffdc 100644--- a/packages/desktop-client/src/components/settings/AuthSettings.tsx+++ b/packages/desktop-client/src/components/settings/AuthSettings.tsx@@ -1,10 +1,10 @@import React from 'react';import { Trans, useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { pushModal } from 'loot-core/client/actions';import { useFeatureFlag } from '../../hooks/useFeatureFlag';+import { useDispatch } from '../../redux';import { theme } from '../../style';import { Button } from '../common/Button2';import { Label } from '../common/Label';diff --git a/packages/desktop-client/src/components/settings/Encryption.tsx b/packages/desktop-client/src/components/settings/Encryption.tsxindex 8a35bf9f73..fa65538415 100644--- a/packages/desktop-client/src/components/settings/Encryption.tsx+++ b/packages/desktop-client/src/components/settings/Encryption.tsx@@ -1,10 +1,10 @@import React from 'react';import { Trans } from 'react-i18next';-import { useDispatch } from 'react-redux';import { pushModal } from 'loot-core/client/actions';import { useMetadataPref } from '../../hooks/useMetadataPref';+import { useDispatch } from '../../redux';import { theme } from '../../style';import { Button } from '../common/Button2';import { Link } from '../common/Link';diff --git a/packages/desktop-client/src/components/settings/Reset.tsx b/packages/desktop-client/src/components/settings/Reset.tsxindex f698d99544..a9ef6e293b 100644--- a/packages/desktop-client/src/components/settings/Reset.tsx+++ b/packages/desktop-client/src/components/settings/Reset.tsx@@ -1,11 +1,11 @@import React, { useState } from 'react';import { Trans } from 'react-i18next';-import { useDispatch } from 'react-redux';import { resetSync } from 'loot-core/client/actions';import { send } from 'loot-core/src/platform/client/fetch';import { useMetadataPref } from '../../hooks/useMetadataPref';+import { useDispatch } from '../../redux';import { ButtonWithLoading } from '../common/Button2';import { Text } from '../common/Text';diff --git a/packages/desktop-client/src/components/settings/index.tsx b/packages/desktop-client/src/components/settings/index.tsxindex e5ada57471..491ed850e6 100644--- a/packages/desktop-client/src/components/settings/index.tsx+++ b/packages/desktop-client/src/components/settings/index.tsx@@ -1,6 +1,5 @@import React, { type ReactNode, useEffect } from 'react';import { useTranslation, Trans } from 'react-i18next';-import { useDispatch } from 'react-redux';import { css } from '@emotion/css';@@ -11,6 +10,7 @@ import { listen } from 'loot-core/src/platform/client/fetch';import { useGlobalPref } from '../../hooks/useGlobalPref';import { useIsOutdated, useLatestVersion } from '../../hooks/useLatestVersion';import { useMetadataPref } from '../../hooks/useMetadataPref';+import { useDispatch } from '../../redux';import { theme } from '../../style';import { tokens } from '../../tokens';import { Button } from '../common/Button2';diff --git a/packages/desktop-client/src/components/sidebar/Account.tsx b/packages/desktop-client/src/components/sidebar/Account.tsxindex d11549f2a0..bc72d78c2f 100644--- a/packages/desktop-client/src/components/sidebar/Account.tsx+++ b/packages/desktop-client/src/components/sidebar/Account.tsx@@ -1,6 +1,5 @@// @ts-strict-ignoreimport React, { type CSSProperties, useRef, useState } from 'react';-import { useDispatch } from 'react-redux';import { css, cx } from '@emotion/css';@@ -14,6 +13,7 @@ import { type AccountEntity } from 'loot-core/src/types/models';import { useContextMenu } from '../../hooks/useContextMenu';import { useNotes } from '../../hooks/useNotes';+import { useDispatch } from '../../redux';import { styles, theme } from '../../style';import { AlignedText } from '../common/AlignedText';import { InitialFocus } from '../common/InitialFocus';diff --git a/packages/desktop-client/src/components/sidebar/Accounts.tsx b/packages/desktop-client/src/components/sidebar/Accounts.tsxindex 62dae51733..b260c15555 100644--- a/packages/desktop-client/src/components/sidebar/Accounts.tsx+++ b/packages/desktop-client/src/components/sidebar/Accounts.tsx@@ -1,10 +1,8 @@import React, { useState } from 'react';import { useTranslation } from 'react-i18next';-import { useDispatch, useSelector } from 'react-redux';import { moveAccount } from 'loot-core/src/client/actions';import * as queries from 'loot-core/src/client/queries';-import { type State } from 'loot-core/src/client/state-types';import { type AccountEntity } from 'loot-core/types/models';import { useAccounts } from '../../hooks/useAccounts';@@ -14,6 +12,7 @@ import { useLocalPref } from '../../hooks/useLocalPref';import { useOffBudgetAccounts } from '../../hooks/useOffBudgetAccounts';import { useOnBudgetAccounts } from '../../hooks/useOnBudgetAccounts';import { useUpdatedAccounts } from '../../hooks/useUpdatedAccounts';+import { useSelector, useDispatch } from '../../redux';import { theme } from '../../style';import { View } from '../common/View';@@ -32,9 +31,7 @@ export function Accounts() {const offbudgetAccounts = useOffBudgetAccounts();const onBudgetAccounts = useOnBudgetAccounts();const closedAccounts = useClosedAccounts();- const syncingAccountIds = useSelector(- (state: State) => state.account.accountsSyncing,- );+ const syncingAccountIds = useSelector(state => state.account.accountsSyncing);const getAccountPath = (account: AccountEntity) => `/accounts/${account.id}`;@@ -120,8 +117,8 @@ export function Accounts() {account={account}connected={!!account.bank}pending={syncingAccountIds.includes(account.id)}- failed={failedAccounts?.has(account.id)}- updated={updatedAccounts?.includes(account.id)}+ failed={failedAccounts.has(account.id)}+ updated={updatedAccounts.includes(account.id)}to={getAccountPath(account)}query={queries.accountBalance(account)}onDragChange={onDragChange}@@ -150,8 +147,8 @@ export function Accounts() {account={account}connected={!!account.bank}pending={syncingAccountIds.includes(account.id)}- failed={failedAccounts?.has(account.id)}- updated={updatedAccounts?.includes(account.id)}+ failed={failedAccounts.has(account.id)}+ updated={updatedAccounts.includes(account.id)}to={getAccountPath(account)}query={queries.accountBalance(account)}onDragChange={onDragChange}diff --git a/packages/desktop-client/src/components/sidebar/BudgetName.tsx b/packages/desktop-client/src/components/sidebar/BudgetName.tsxindex 3201d97676..ca7cb9bad9 100644--- a/packages/desktop-client/src/components/sidebar/BudgetName.tsx+++ b/packages/desktop-client/src/components/sidebar/BudgetName.tsx@@ -1,6 +1,5 @@import React, { type ReactNode, useRef, useState } from 'react';import { useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { closeBudget } from 'loot-core/src/client/actions';import * as Platform from 'loot-core/src/client/platform';@@ -9,6 +8,7 @@ import { useContextMenu } from '../../hooks/useContextMenu';import { useMetadataPref } from '../../hooks/useMetadataPref';import { useNavigate } from '../../hooks/useNavigate';import { SvgExpandArrow } from '../../icons/v0';+import { useDispatch } from '../../redux';import { theme } from '../../style';import { Button } from '../common/Button2';import { InitialFocus } from '../common/InitialFocus';diff --git a/packages/desktop-client/src/components/sidebar/Sidebar.tsx b/packages/desktop-client/src/components/sidebar/Sidebar.tsxindex 9f9d4c4953..d7d5394424 100644--- a/packages/desktop-client/src/components/sidebar/Sidebar.tsx+++ b/packages/desktop-client/src/components/sidebar/Sidebar.tsx@@ -1,6 +1,5 @@import React, { type CSSProperties, useState } from 'react';import { useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { css } from '@emotion/css';import { Resizable } from 're-resizable';@@ -12,6 +11,7 @@ import { useGlobalPref } from '../../hooks/useGlobalPref';import { useLocalPref } from '../../hooks/useLocalPref';import { useResizeObserver } from '../../hooks/useResizeObserver';import { SvgAdd } from '../../icons/v1';+import { useDispatch } from '../../redux';import { styles, theme } from '../../style';import { View } from '../common/View';import { useResponsive } from '../responsive/ResponsiveProvider';diff --git a/packages/desktop-client/src/components/table.tsx b/packages/desktop-client/src/components/table.tsxindex a253acd89c..d62de7ed99 100644--- a/packages/desktop-client/src/components/table.tsx+++ b/packages/desktop-client/src/components/table.tsx@@ -4,7 +4,6 @@ import React, {useState,useCallback,useRef,- useEffect,useLayoutEffect,useImperativeHandle,useMemo,@@ -17,9 +16,9 @@ import React, {type MutableRefObject,type CSSProperties,} from 'react';-import { useStore } from 'react-redux';import AutoSizer from 'react-virtualized-auto-sizer';+import { useModalState } from '../hooks/useModalState';import {AvoidRefocusScrollProvider,useProperFocus,@@ -1229,8 +1228,8 @@ export function useTableNavigator<T extends TableItem>(const containerRef = useRef<HTMLDivElement>();// See `onBlur` for why we need this- const store = useStore();- const modalStackLength = useRef(0);+ const modalState = useModalState();+ const modalStackLength = useRef(modalState.modalStack.length);// onEdit is passed to children, so make sure it maintains identityconst onEdit = useCallback((id: T['id'], field?: string) => {@@ -1238,10 +1237,6 @@ export function useTableNavigator<T extends TableItem>(setFocusedField(id ? field : null);}, []);- useEffect(() => {- modalStackLength.current = store.getState().modals.modalStack.length;- }, []);-function flashInput() {// Force the container to be focused which suppresses the "space// pages down" behavior. If we don't do this and the user presses@@ -1396,7 +1391,7 @@ export function useTableNavigator<T extends TableItem>(// modal just opened. This way the field still shows an// input, and it will be refocused when the modal closes.const prevNumModals = modalStackLength.current;- const numModals = store.getState().modals.modalStack.length;+ const numModals = modalState.modalStack.length;if (document.hasFocus() &&diff --git a/packages/desktop-client/src/components/transactions/SelectedTransactionsButton.tsx b/packages/desktop-client/src/components/transactions/SelectedTransactionsButton.tsxindex fa1c85836e..f11325572a 100644--- a/packages/desktop-client/src/components/transactions/SelectedTransactionsButton.tsx+++ b/packages/desktop-client/src/components/transactions/SelectedTransactionsButton.tsx@@ -1,7 +1,6 @@import { useMemo } from 'react';import { useHotkeys } from 'react-hotkeys-hook';import { useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { pushModal } from 'loot-core/client/actions';import { isPreviewId } from 'loot-core/shared/transactions';@@ -9,6 +8,7 @@ import { validForTransfer } from 'loot-core/src/client/transfer';import { type TransactionEntity } from 'loot-core/types/models';import { useSelectedItems } from '../../hooks/useSelected';+import { useDispatch } from '../../redux';import { Menu } from '../common/Menu';import { SelectedItemsButton } from '../table';diff --git a/packages/desktop-client/src/components/transactions/TransactionList.jsx b/packages/desktop-client/src/components/transactions/TransactionList.jsxindex 849c6daf49..89b6706875 100644--- a/packages/desktop-client/src/components/transactions/TransactionList.jsx+++ b/packages/desktop-client/src/components/transactions/TransactionList.jsx@@ -1,5 +1,4 @@import React, { useRef, useCallback, useLayoutEffect } from 'react';-import { useDispatch } from 'react-redux';import { pushModal } from 'loot-core/client/actions';import { send } from 'loot-core/src/platform/client/fetch';@@ -13,6 +12,7 @@ import {import { getChangedValues, applyChanges } from 'loot-core/src/shared/util';import { useNavigate } from '../../hooks/useNavigate';+import { useDispatch } from '../../redux';import { theme } from '../../style';import { TransactionTable } from './TransactionsTable';diff --git a/packages/desktop-client/src/components/transactions/TransactionMenu.tsx b/packages/desktop-client/src/components/transactions/TransactionMenu.tsxindex e2723014d8..1d87d30a4d 100644--- a/packages/desktop-client/src/components/transactions/TransactionMenu.tsx+++ b/packages/desktop-client/src/components/transactions/TransactionMenu.tsx@@ -1,11 +1,11 @@import React, { type ComponentPropsWithoutRef } from 'react';import { useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { pushModal } from 'loot-core/client/actions';import { isPreviewId } from 'loot-core/shared/transactions';import { type TransactionEntity } from 'loot-core/types/models';+import { useDispatch } from '../../redux';import { Menu } from '../common/Menu';type BalanceMenuProps = Omit<diff --git a/packages/desktop-client/src/components/transactions/TransactionsTable.jsx b/packages/desktop-client/src/components/transactions/TransactionsTable.jsxindex adcdaa7067..2a4949a8b1 100644--- a/packages/desktop-client/src/components/transactions/TransactionsTable.jsx+++ b/packages/desktop-client/src/components/transactions/TransactionsTable.jsx@@ -12,7 +12,6 @@ import React, {} from 'react';import { useHotkeys } from 'react-hotkeys-hook';import { useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';import { css } from '@emotion/css';import {@@ -60,6 +59,7 @@ import {SvgCalendar,SvgHyperlink2,} from '../../icons/v2';+import { useDispatch } from '../../redux';import { styles, theme } from '../../style';import { AccountAutocomplete } from '../autocomplete/AccountAutocomplete';import { CategoryAutocomplete } from '../autocomplete/CategoryAutocomplete';diff --git a/packages/desktop-client/src/components/transactions/TransactionsTable.test.jsx b/packages/desktop-client/src/components/transactions/TransactionsTable.test.jsxindex 5f5ed4c417..3acca82945 100644--- a/packages/desktop-client/src/components/transactions/TransactionsTable.test.jsx+++ b/packages/desktop-client/src/components/transactions/TransactionsTable.test.jsx@@ -12,7 +12,6 @@ import {generateAccount,generateCategoryGroups,} from 'loot-core/src/mocks';-import { TestProvider } from 'loot-core/src/mocks/redux';import { initServer } from 'loot-core/src/platform/client/fetch';import {addSplitTransaction,@@ -25,6 +24,7 @@ import { integerToCurrency } from 'loot-core/src/shared/util';import { AuthProvider } from '../../auth/AuthProvider';import { SelectedProviderWithItems } from '../../hooks/useSelected';import { SplitsExpandedProvider } from '../../hooks/useSplitsExpanded';+import { TestProvider } from '../../redux/mock';import { ResponsiveProvider } from '../responsive/ResponsiveProvider';import { TransactionTable } from './TransactionsTable';diff --git a/packages/desktop-client/src/components/util/GenericInput.jsx b/packages/desktop-client/src/components/util/GenericInput.jsxindex f718cdcb41..3ed5d8ca7d 100644--- a/packages/desktop-client/src/components/util/GenericInput.jsx+++ b/packages/desktop-client/src/components/util/GenericInput.jsx@@ -1,5 +1,4 @@import React from 'react';-import { useSelector } from 'react-redux';import { useReports } from 'loot-core/client/data-hooks/reports';import { getMonthYearFormat } from 'loot-core/src/shared/months';@@ -7,6 +6,7 @@ import { integerToAmount, amountToInteger } from 'loot-core/src/shared/util';import { useCategories } from '../../hooks/useCategories';import { useDateFormat } from '../../hooks/useDateFormat';+import { useSelector } from '../../redux';import { AccountAutocomplete } from '../autocomplete/AccountAutocomplete';import { Autocomplete } from '../autocomplete/Autocomplete';import { CategoryAutocomplete } from '../autocomplete/CategoryAutocomplete';diff --git a/packages/desktop-client/src/global-events.ts b/packages/desktop-client/src/global-events.tsindex 619f673b25..8d18609d4b 100644--- a/packages/desktop-client/src/global-events.ts+++ b/packages/desktop-client/src/global-events.ts@@ -75,7 +75,7 @@ export function handleGlobalEvents(actions: BoundActions, store: Store<State>) {if (tagged) {Promise.all(promises).then(() => {- actions.setLastUndoState(undoState);+ undo.setUndoState('undoEvent', undoState);// If a modal has been tagged, open it instead of navigatingif (tagged.openModal) {diff --git a/packages/desktop-client/src/gocardless.ts b/packages/desktop-client/src/gocardless.tsindex b9861626bc..dc4d48b633 100644--- a/packages/desktop-client/src/gocardless.ts+++ b/packages/desktop-client/src/gocardless.ts@@ -1,10 +1,10 @@-import { type Dispatch } from 'loot-core/client/actions/types';+import { type AppDispatch } from 'loot-core/client/store';import { pushModal } from 'loot-core/src/client/actions/modals';import { send } from 'loot-core/src/platform/client/fetch';import { type GoCardlessToken } from 'loot-core/src/types/models';function _authorize(- dispatch: Dispatch,+ dispatch: AppDispatch,upgradingAccountId: string | undefined,{onSuccess,@@ -40,7 +40,7 @@ function _authorize(}export async function authorizeBank(- dispatch: Dispatch,+ dispatch: AppDispatch,{ upgradingAccountId }: { upgradingAccountId?: string } = {},) {_authorize(dispatch, upgradingAccountId, {diff --git a/packages/desktop-client/src/hooks/useAccounts.ts b/packages/desktop-client/src/hooks/useAccounts.tsindex 4c44e9cec9..06b279a0b1 100644--- a/packages/desktop-client/src/hooks/useAccounts.ts+++ b/packages/desktop-client/src/hooks/useAccounts.ts@@ -1,14 +1,12 @@import { useEffect } from 'react';-import { useDispatch, useSelector } from 'react-redux';import { getAccounts } from 'loot-core/src/client/actions';-import { type State } from 'loot-core/src/client/state-types';++import { useSelector, useDispatch } from '../redux';export function useAccounts() {const dispatch = useDispatch();- const accountsLoaded = useSelector(- (state: State) => state.queries.accountsLoaded,- );+ const accountsLoaded = useSelector(state => state.queries.accountsLoaded);useEffect(() => {if (!accountsLoaded) {diff --git a/packages/desktop-client/src/hooks/useActions.ts b/packages/desktop-client/src/hooks/useActions.tsindex 2952eaf8a0..f1ed715c7e 100644--- a/packages/desktop-client/src/hooks/useActions.ts+++ b/packages/desktop-client/src/hooks/useActions.ts@@ -1,5 +1,4 @@import { useMemo } from 'react';-import { useDispatch } from 'react-redux';import { bindActionCreators } from 'redux';import { type ThunkAction } from 'redux-thunk';@@ -7,6 +6,8 @@ import { type ThunkAction } from 'redux-thunk';import * as actions from 'loot-core/src/client/actions';import type { Action, State } from 'loot-core/src/client/state-types';+import { useDispatch } from '../redux';+type ActionReturnType<T extends (...args: unknown[]) => unknown> =ReturnType<T> extends ThunkAction<infer ReturnType, State, never, Action>? ReturnType@@ -21,7 +22,7 @@ export type BoundActions = {// https://react-redux.js.org/api/hooks#recipe-useactions/**- * @deprecated please use actions directly with `useDispatch`+ * @deprecated please use actions directly with `useAppDispatch`* @see https://github.com/reduxjs/react-redux/issues/1252#issuecomment-488160930**/export function useActions() {diff --git a/packages/desktop-client/src/hooks/useCategories.ts b/packages/desktop-client/src/hooks/useCategories.tsindex 4c85fdfaff..6963c06f72 100644--- a/packages/desktop-client/src/hooks/useCategories.ts+++ b/packages/desktop-client/src/hooks/useCategories.ts@@ -1,14 +1,12 @@import { useEffect } from 'react';-import { useDispatch, useSelector } from 'react-redux';import { getCategories } from 'loot-core/src/client/actions';-import { type State } from 'loot-core/src/client/state-types';++import { useSelector, useDispatch } from '../redux';export function useCategories() {const dispatch = useDispatch();- const categoriesLoaded = useSelector(- (state: State) => state.queries.categoriesLoaded,- );+ const categoriesLoaded = useSelector(state => state.queries.categoriesLoaded);useEffect(() => {if (!categoriesLoaded) {diff --git a/packages/desktop-client/src/hooks/useFailedAccounts.ts b/packages/desktop-client/src/hooks/useFailedAccounts.tsindex 86aeb89959..86b20b948f 100644--- a/packages/desktop-client/src/hooks/useFailedAccounts.ts+++ b/packages/desktop-client/src/hooks/useFailedAccounts.ts@@ -1,7 +1,11 @@-import { useSelector } from 'react-redux';+import { useMemo } from 'react';-import { type State } from 'loot-core/src/client/state-types';+import { useSelector } from '../redux';export function useFailedAccounts() {- return useSelector((state: State) => state.account.failedAccounts);+ const failedAccounts = useSelector(state => state.account.failedAccounts);+ return useMemo(+ () => new Map(Object.entries(failedAccounts)),+ [failedAccounts],+ );}diff --git a/packages/desktop-client/src/hooks/useGlobalPref.ts b/packages/desktop-client/src/hooks/useGlobalPref.tsindex 4f686a2aef..22e2c1ef80 100644--- a/packages/desktop-client/src/hooks/useGlobalPref.ts+++ b/packages/desktop-client/src/hooks/useGlobalPref.ts@@ -1,10 +1,10 @@import { useCallback } from 'react';-import { useDispatch, useSelector } from 'react-redux';import { saveGlobalPrefs } from 'loot-core/src/client/actions';-import { type State } from 'loot-core/src/client/state-types';import { type GlobalPrefs } from 'loot-core/src/types/prefs';+import { useSelector, useDispatch } from '../redux';+type SetGlobalPrefAction<K extends keyof GlobalPrefs> = (value: GlobalPrefs[K],) => void;@@ -28,7 +28,7 @@ export function useGlobalPref<K extends keyof GlobalPrefs>([prefName, dispatch, onSaveGlobalPrefs],);const globalPref = useSelector(- (state: State) => state.prefs.global?.[prefName] as GlobalPrefs[K],+ state => state.prefs.global?.[prefName] as GlobalPrefs[K],);return [globalPref, setGlobalPref];diff --git a/packages/desktop-client/src/hooks/useMetadataPref.ts b/packages/desktop-client/src/hooks/useMetadataPref.tsindex 57d4b7902b..7a16605996 100644--- a/packages/desktop-client/src/hooks/useMetadataPref.ts+++ b/packages/desktop-client/src/hooks/useMetadataPref.ts@@ -1,10 +1,10 @@import { useCallback } from 'react';-import { useDispatch, useSelector } from 'react-redux';import { savePrefs } from 'loot-core/client/actions';-import { type State } from 'loot-core/client/state-types';import { type MetadataPrefs } from 'loot-core/types/prefs';+import { useSelector, useDispatch } from '../redux';+type SetMetadataPrefAction<K extends keyof MetadataPrefs> = (value: MetadataPrefs[K],) => void;@@ -19,9 +19,7 @@ export function useMetadataPref<K extends keyof MetadataPrefs>(},[prefName, dispatch],);- const localPref = useSelector(- (state: State) => state.prefs.local?.[prefName],- );+ const localPref = useSelector(state => state.prefs.local?.[prefName]);return [localPref, setLocalPref];}diff --git a/packages/desktop-client/src/hooks/useModalState.ts b/packages/desktop-client/src/hooks/useModalState.tsindex 1810ba7fa6..9b01288eea 100644--- a/packages/desktop-client/src/hooks/useModalState.ts+++ b/packages/desktop-client/src/hooks/useModalState.ts@@ -1,10 +1,10 @@import { useCallback } from 'react';-import { useDispatch, useSelector } from 'react-redux';import { popModal } from 'loot-core/client/actions';-import { type State } from 'loot-core/client/state-types';import { type Modal } from 'loot-core/client/state-types/modals';+import { useSelector, useDispatch } from '../redux';+type ModalState = {onClose: () => void;modalStack: Modal[];@@ -14,8 +14,8 @@ type ModalState = {};export function useModalState(): ModalState {- const modalStack = useSelector((state: State) => state.modals.modalStack);- const isHidden = useSelector((state: State) => state.modals.isHidden);+ const modalStack = useSelector(state => state.modals.modalStack);+ const isHidden = useSelector(state => state.modals.isHidden);const dispatch = useDispatch();const popModalCallback = useCallback(() => {diff --git a/packages/desktop-client/src/hooks/usePayees.ts b/packages/desktop-client/src/hooks/usePayees.tsindex cffa9df067..91732a6d40 100644--- a/packages/desktop-client/src/hooks/usePayees.ts+++ b/packages/desktop-client/src/hooks/usePayees.ts@@ -1,13 +1,13 @@import { useEffect } from 'react';-import { useDispatch, useSelector } from 'react-redux';import { getCommonPayees, getPayees } from 'loot-core/src/client/actions';-import { type State } from 'loot-core/src/client/state-types';++import { useSelector, useDispatch } from '../redux';export function useCommonPayees() {const dispatch = useDispatch();const commonPayeesLoaded = useSelector(- (state: State) => state.queries.commonPayeesLoaded,+ state => state.queries.commonPayeesLoaded,);useEffect(() => {@@ -21,9 +21,7 @@ export function useCommonPayees() {export function usePayees() {const dispatch = useDispatch();- const payeesLoaded = useSelector(- (state: State) => state.queries.payeesLoaded,- );+ const payeesLoaded = useSelector(state => state.queries.payeesLoaded);useEffect(() => {if (!payeesLoaded) {diff --git a/packages/desktop-client/src/hooks/useSelected.tsx b/packages/desktop-client/src/hooks/useSelected.tsxindex ceab8ce560..d26e8c96b7 100644--- a/packages/desktop-client/src/hooks/useSelected.tsx+++ b/packages/desktop-client/src/hooks/useSelected.tsx@@ -10,9 +10,7 @@ import React, {type ReactElement,type ReactNode,} from 'react';-import { useSelector } from 'react-redux';-import { type State } from 'loot-core/src/client/state-types';import { listen } from 'loot-core/src/platform/client/fetch';import * as undo from 'loot-core/src/platform/client/undo';import { type UndoState } from 'loot-core/src/server/undo';@@ -208,8 +206,6 @@ export function useSelected<T extends Item>(return () => undo.setUndoState('selectedItems', prevState);}, [state.selectedItems]);- const lastUndoState = useSelector((state: State) => state.app.lastUndoState);-useEffect(() => {function onUndo({ messages, undoTag }: UndoState) {const tagged = undo.getTaggedState(undoTag);@@ -231,8 +227,9 @@ export function useSelected<T extends Item>(}}- if (lastUndoState && lastUndoState.current) {- onUndo(lastUndoState.current);+ const lastUndoEvent = undo.getUndoState('undoEvent');+ if (lastUndoEvent) {+ onUndo(lastUndoEvent);}return listen('undo-event', onUndo);diff --git a/packages/desktop-client/src/hooks/useSplitsExpanded.tsx b/packages/desktop-client/src/hooks/useSplitsExpanded.tsxindex 25386d2dce..2d178e152d 100644--- a/packages/desktop-client/src/hooks/useSplitsExpanded.tsx+++ b/packages/desktop-client/src/hooks/useSplitsExpanded.tsx@@ -6,13 +6,15 @@ import React, {useReducer,type Dispatch,type ReactNode,+ useRef,} from 'react';-import { useSelector, useDispatch } from 'react-redux';-import {- type SplitMode,- type SplitState,-} from 'loot-core/client/state-types/app';+type SplitMode = 'collapse' | 'expand';+type SplitState = {+ ids: Set<string>;+ mode: SplitMode;+ transitionId: string | null;+};type ToggleSplitAction = {type: 'toggle-split';@@ -59,7 +61,7 @@ type SplitsStateContext = {const SplitsExpandedContext = createContext<SplitsStateContext>({state: {mode: 'collapse',- ids: new Set(),+ ids: new Set<string>(),transitionId: null,},dispatch: () => {@@ -73,10 +75,11 @@ export function useSplitsExpanded() {return useMemo(() => ({...data,- isExpanded: (id: string) =>- data.state.mode === 'collapse'+ isExpanded: (id: string) => {+ return data.state.mode === 'collapse'? !data.state.ids.has(id)- : data.state.ids.has(id),+ : data.state.ids.has(id);+ },}),[data],);@@ -91,8 +94,7 @@ export function SplitsExpandedProvider({children,initialMode = 'expand',}: SplitsExpandedProviderProps) {- const cachedState = useSelector(state => state.app.lastSplitState);- const reduxDispatch = useDispatch();+ const previousState = useRef<SplitState | null>(null);const [state, dispatch] = useReducer((state: SplitState, action: Actions): SplitState => {@@ -152,7 +154,7 @@ export function SplitsExpandedProvider({return { ...state, transitionId: null };}},- cachedState.current || {+ previousState.current || {ids: new Set<string>(),mode: initialMode,transitionId: null,@@ -171,9 +173,9 @@ export function SplitsExpandedProvider({useEffect(() => {// In a finished state, cache the stateif (state.transitionId == null) {- reduxDispatch({ type: 'SET_LAST_SPLIT_STATE', splitState: state });+ previousState.current = state;}- }, [reduxDispatch, state]);+ }, [state]);const value = useMemo(() => ({ state, dispatch }), [state, dispatch]);diff --git a/packages/desktop-client/src/hooks/useSyncServerStatus.ts b/packages/desktop-client/src/hooks/useSyncServerStatus.tsindex f9a2351d3f..d3c1c733b1 100644--- a/packages/desktop-client/src/hooks/useSyncServerStatus.ts+++ b/packages/desktop-client/src/hooks/useSyncServerStatus.ts@@ -1,14 +1,11 @@-import { useSelector } from 'react-redux';--import { type State } from 'loot-core/src/client/state-types';-import { useServerURL } from '../components/ServerContext';+import { useSelector } from '../redux';type SyncServerStatus = 'offline' | 'no-server' | 'online';export function useSyncServerStatus(): SyncServerStatus {const serverUrl = useServerURL();- const userData = useSelector((state: State) => state.user.data);+ const userData = useSelector(state => state.user.data);if (!serverUrl) {return 'no-server';diff --git a/packages/desktop-client/src/hooks/useSyncedPref.ts b/packages/desktop-client/src/hooks/useSyncedPref.tsindex 67808eeb97..310328a836 100644--- a/packages/desktop-client/src/hooks/useSyncedPref.ts+++ b/packages/desktop-client/src/hooks/useSyncedPref.ts@@ -1,10 +1,10 @@import { useCallback } from 'react';-import { useDispatch, useSelector } from 'react-redux';import { saveSyncedPrefs } from 'loot-core/client/actions';-import { type State } from 'loot-core/client/state-types';import { type SyncedPrefs } from 'loot-core/src/types/prefs';+import { useSelector, useDispatch } from '../redux';+type SetSyncedPrefAction<K extends keyof SyncedPrefs> = (value: SyncedPrefs[K],) => void;@@ -19,7 +19,7 @@ export function useSyncedPref<K extends keyof SyncedPrefs>(},[prefName, dispatch],);- const pref = useSelector((state: State) => state.prefs.synced[prefName]);+ const pref = useSelector(state => state.prefs.synced[prefName]);return [pref, setPref];}diff --git a/packages/desktop-client/src/hooks/useSyncedPrefs.ts b/packages/desktop-client/src/hooks/useSyncedPrefs.tsindex 5749379489..cdef01a4e9 100644--- a/packages/desktop-client/src/hooks/useSyncedPrefs.ts+++ b/packages/desktop-client/src/hooks/useSyncedPrefs.ts@@ -1,10 +1,10 @@import { useCallback } from 'react';-import { useDispatch, useSelector } from 'react-redux';import { saveSyncedPrefs } from 'loot-core/client/actions';-import { type State } from 'loot-core/client/state-types';import { type SyncedPrefs } from 'loot-core/src/types/prefs';+import { useSelector, useDispatch } from '../redux';+type SetSyncedPrefsAction = (value: Partial<SyncedPrefs>) => void;/** @deprecated: please use `useSyncedPref` (singular) */@@ -16,7 +16,7 @@ export function useSyncedPrefs(): [SyncedPrefs, SetSyncedPrefsAction] {},[dispatch],);- const prefs = useSelector((state: State) => state.prefs.synced);+ const prefs = useSelector(state => state.prefs.synced);return [prefs, setPrefs];}diff --git a/packages/desktop-client/src/hooks/useTransactionBatchActions.ts b/packages/desktop-client/src/hooks/useTransactionBatchActions.tsindex a49c1efbf5..ff612ac4c8 100644--- a/packages/desktop-client/src/hooks/useTransactionBatchActions.ts+++ b/packages/desktop-client/src/hooks/useTransactionBatchActions.ts@@ -1,5 +1,3 @@-import { useDispatch } from 'react-redux';-import { pushModal } from 'loot-core/client/actions';import { runQuery } from 'loot-core/client/query-helpers';import { send } from 'loot-core/platform/client/fetch';@@ -19,6 +17,8 @@ import {type TransactionEntity,} from 'loot-core/types/models';+import { useDispatch } from '../redux';+type BatchEditProps = {name: keyof TransactionEntity;ids: Array<TransactionEntity['id']>;diff --git a/packages/desktop-client/src/hooks/useUndo.ts b/packages/desktop-client/src/hooks/useUndo.tsindex 0ab580f44f..2e5f887189 100644--- a/packages/desktop-client/src/hooks/useUndo.ts+++ b/packages/desktop-client/src/hooks/useUndo.ts@@ -1,10 +1,10 @@import { useCallback } from 'react';-import { useDispatch } from 'react-redux';import { undo, redo, addNotification } from 'loot-core/client/actions';import { type Notification } from 'loot-core/client/state-types/notifications';import { useResponsive } from '../components/responsive/ResponsiveProvider';+import { useDispatch } from '../redux';type UndoActions = {undo: () => void;diff --git a/packages/desktop-client/src/hooks/useUpdatedAccounts.ts b/packages/desktop-client/src/hooks/useUpdatedAccounts.tsindex 483d22c9b5..25a7ec729d 100644--- a/packages/desktop-client/src/hooks/useUpdatedAccounts.ts+++ b/packages/desktop-client/src/hooks/useUpdatedAccounts.ts@@ -1,7 +1,5 @@-import { useSelector } from 'react-redux';--import { type State } from 'loot-core/src/client/state-types';+import { useSelector } from '../redux';export function useUpdatedAccounts() {- return useSelector((state: State) => state.queries.updatedAccounts);+ return useSelector(state => state.queries.updatedAccounts);}diff --git a/packages/desktop-client/src/index.tsx b/packages/desktop-client/src/index.tsxindex 296e6f07ee..9612414cc7 100644--- a/packages/desktop-client/src/index.tsx+++ b/packages/desktop-client/src/index.tsx@@ -10,20 +10,12 @@ import './i18n';import React from 'react';import { Provider } from 'react-redux';+import { bindActionCreators } from '@reduxjs/toolkit';import { createRoot } from 'react-dom/client';-import {- createStore,- combineReducers,- applyMiddleware,- bindActionCreators,-} from 'redux';-import thunk from 'redux-thunk';import * as actions from 'loot-core/src/client/actions';-import * as constants from 'loot-core/src/client/constants';import { runQuery } from 'loot-core/src/client/query-helpers';-import { reducers } from 'loot-core/src/client/reducers';-import { initialState as initialAppState } from 'loot-core/src/client/reducers/app';+import { store } from 'loot-core/src/client/store';import { send } from 'loot-core/src/platform/client/fetch';import { q } from 'loot-core/src/shared/query';@@ -37,34 +29,6 @@ import { type BoundActions } from './hooks/useActions';// focus outline appear from keyboard events.import 'focus-visible';-const appReducer = combineReducers(reducers);-function rootReducer(state, action) {- if (action.type === constants.CLOSE_BUDGET) {- // Reset the state and only keep around things intentionally. This- // blows away everything else- state = {- budgets: state.budgets,- user: state.user,- prefs: { local: null, global: state.prefs.global },- app: {- ...initialAppState,- updateInfo: state.updateInfo,- showUpdateNotification: state.showUpdateNotification,- managerHasInitialized: state.app.managerHasInitialized,- loadingText: state.app.loadingText,- },- };- }-- return appReducer(state, action);-}--const compose = window['__REDUX_DEVTOOLS_EXTENSION_COMPOSE__'] || (f => f);-const store = createStore(- rootReducer,- undefined,- compose(applyMiddleware(thunk)),-);const boundActions = bindActionCreators(actions,store.dispatch,diff --git a/packages/desktop-client/src/redux/index.ts b/packages/desktop-client/src/redux/index.tsnew file mode 100644index 0000000000..5cb89bbd39--- /dev/null+++ b/packages/desktop-client/src/redux/index.ts@@ -0,0 +1,9 @@+import {+ useDispatch as useReduxDispatch,+ useSelector as useReduxSelector,+} from 'react-redux';++import { type AppDispatch, type RootState } from 'loot-core/client/store';++export const useDispatch = useReduxDispatch.withTypes<AppDispatch>();+export const useSelector = useReduxSelector.withTypes<RootState>();diff --git a/packages/desktop-client/src/redux/mock.tsx b/packages/desktop-client/src/redux/mock.tsxnew file mode 100644index 0000000000..138259bdc2--- /dev/null+++ b/packages/desktop-client/src/redux/mock.tsx@@ -0,0 +1,8 @@+import React, { type ReactNode } from 'react';+import { Provider } from 'react-redux';++import { mockStore } from 'loot-core/client/store/mock';++export function TestProvider({ children }: { children: ReactNode }) {+ return <Provider store={mockStore}>{children}</Provider>;+}diff --git a/packages/desktop-client/src/setupTests.js b/packages/desktop-client/src/setupTests.jsindex 0975add586..a645eae5bf 100644--- a/packages/desktop-client/src/setupTests.js+++ b/packages/desktop-client/src/setupTests.js@@ -1,4 +1,4 @@-import { resetStore } from 'loot-core/src/mocks/redux';+import { resetMockStore } from 'loot-core/src/client/store/mock';import { installPolyfills } from './polyfills';@@ -16,7 +16,7 @@ vi.mock('react-virtualized-auto-sizer', () => ({global.Date.now = () => 123456789;global.__resetWorld = () => {- resetStore();+ resetMockStore();};process.on('unhandledRejection', reason => {diff --git a/packages/loot-core/package.json b/packages/loot-core/package.jsonindex cd8257cba3..a5b50a07bb 100644--- a/packages/loot-core/package.json+++ b/packages/loot-core/package.json@@ -18,6 +18,7 @@"license": "ISC","dependencies": {"@jlongster/sql.js": "^1.6.7",+ "@reduxjs/toolkit": "^2.5.0","@rschedule/core": "^1.5.0","@rschedule/json-tools": "^1.5.0","@rschedule/standard-date-adapter": "^1.5.0",@@ -49,7 +50,6 @@"@types/jest": "^27.5.2","@types/jlongster__sql.js": "npm:@types/sql.js@latest","@types/pegjs": "^0.10.3",- "@types/react-redux": "^7.1.25","@types/uuid": "^9.0.2","@types/webpack": "^5.28.5","@types/webpack-bundle-analyzer": "^4.6.3",diff --git a/packages/loot-core/src/client/actions/account.ts b/packages/loot-core/src/client/actions/account.tsindex 579366b38b..e7dd9b6991 100644--- a/packages/loot-core/src/client/actions/account.ts+++ b/packages/loot-core/src/client/actions/account.ts@@ -10,10 +10,10 @@ import type {SetLastTransactionAction,UpdateNewTransactionsAction,} from '../state-types/queries';+import { type AppDispatch, type GetRootState } from '../store';import { addNotification } from './notifications';import { getPayees, getAccounts } from './queries';-import type { Dispatch, GetState } from './types';export function setAccountsSyncing(ids: SetAccountsSyncingAction['ids'],@@ -48,7 +48,7 @@ export function markAccountSuccess(}export function unlinkAccount(id: string) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {await send('account-unlink', { id });dispatch(markAccountSuccess(id));dispatch(getAccounts());@@ -61,7 +61,7 @@ export function linkAccount(upgradingId?: string,offBudget?: boolean,) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {await send('gocardless-accounts-link', {requisitionId,account,@@ -78,7 +78,7 @@ export function linkAccountSimpleFin(upgradingId?: string,offBudget?: boolean,) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {await send('simplefin-accounts-link', {externalAccount,upgradingId,@@ -139,7 +139,7 @@ function handleSyncResponse(}export function syncAccounts(id?: string) {- return async (dispatch: Dispatch, getState: GetState) => {+ return async (dispatch: AppDispatch, getState: GetRootState) => {// Disallow two parallel sync operationsif (getState().account.accountsSyncing.length > 0) {return false;@@ -257,7 +257,7 @@ export function parseTransactions(filepath, options) {}export function importPreviewTransactions(id: string, transactions) {- return async (dispatch: Dispatch): Promise<boolean> => {+ return async (dispatch: AppDispatch): Promise<boolean> => {const { errors = [], updatedPreview } = await send('transactions-import', {accountId: id,transactions,@@ -278,7 +278,7 @@ export function importPreviewTransactions(id: string, transactions) {}export function importTransactions(id: string, transactions, reconcile = true) {- return async (dispatch: Dispatch): Promise<boolean> => {+ return async (dispatch: AppDispatch): Promise<boolean> => {if (!reconcile) {await send('api/transactions-add', {accountId: id,@@ -333,7 +333,7 @@ export function markAccountRead(accountId): MarkAccountReadAction {}export function moveAccount(id, targetId) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {await send('account-move', { id, targetId });dispatch(getAccounts());dispatch(getPayees());diff --git a/packages/loot-core/src/client/actions/app.ts b/packages/loot-core/src/client/actions/app.tsindex b2a707ffb2..bc19956403 100644--- a/packages/loot-core/src/client/actions/app.ts+++ b/packages/loot-core/src/client/actions/app.ts@@ -1,13 +1,8 @@// @ts-strict-ignoreimport { send } from '../../platform/client/fetch';import * as constants from '../constants';-import type {- AppState,- SetAppStateAction,- SetLastUndoStateAction,-} from '../state-types/app';--import type { Dispatch } from './types';+import type { AppState, SetAppStateAction } from '../state-types/app';+import { type AppDispatch } from '../store';export function setAppState(state: Partial<AppState>): SetAppStateAction {return {@@ -17,21 +12,12 @@ export function setAppState(state: Partial<AppState>): SetAppStateAction {}export function updateApp() {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {await global.Actual.applyAppUpdate();dispatch(setAppState({ updateInfo: null }));};}-export function setLastUndoState(- undoState: SetLastUndoStateAction['undoState'],-): SetLastUndoStateAction {- return {- type: constants.SET_LAST_UNDO_STATE,- undoState,- };-}-// This is only used in the fake web version where everything runs in// the browser. It's a way to send a file to the backend to be// imported into the virtual filesystem.diff --git a/packages/loot-core/src/client/actions/backups.ts b/packages/loot-core/src/client/actions/backups.tsindex 92218a8f43..51e5100a7b 100644--- a/packages/loot-core/src/client/actions/backups.ts+++ b/packages/loot-core/src/client/actions/backups.ts@@ -1,13 +1,13 @@// @ts-strict-ignoreimport { send } from '../../platform/client/fetch';+import { type AppDispatch, type GetRootState } from '../store';import { closeBudget, loadBudget } from './budgets';-import type { Dispatch, GetState } from './types';// Take in the budget id so that backups can be loaded when a budget// isn't openedexport function loadBackup(budgetId, backupId) {- return async (dispatch: Dispatch, getState: GetState) => {+ return async (dispatch: AppDispatch, getState: GetRootState) => {const prefs = getState().prefs.local;if (prefs && prefs.id) {await dispatch(closeBudget());@@ -19,7 +19,7 @@ export function loadBackup(budgetId, backupId) {}export function makeBackup() {- return async (dispatch: Dispatch, getState: GetState) => {+ return async (dispatch: AppDispatch, getState: GetRootState) => {const prefs = getState().prefs.local;if (prefs && prefs.id) {await send('backup-make', { id: prefs.id });diff --git a/packages/loot-core/src/client/actions/budgets.ts b/packages/loot-core/src/client/actions/budgets.tsindex 8e0a5bfebd..4a36f1f49f 100644--- a/packages/loot-core/src/client/actions/budgets.ts+++ b/packages/loot-core/src/client/actions/budgets.ts@@ -5,14 +5,14 @@ import { send } from '../../platform/client/fetch';import { getDownloadError, getSyncError } from '../../shared/errors';import type { Handlers } from '../../types/handlers';import * as constants from '../constants';+import { type AppDispatch, type GetRootState } from '../store';import { setAppState } from './app';import { closeModal, pushModal } from './modals';import { loadPrefs, loadGlobalPrefs } from './prefs';-import type { Dispatch, GetState } from './types';export function loadBudgets() {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {const budgets = await send('get-budgets');dispatch({@@ -23,7 +23,7 @@ export function loadBudgets() {}export function loadRemoteFiles() {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {const files = await send('get-remote-files');dispatch({@@ -34,7 +34,7 @@ export function loadRemoteFiles() {}export function loadAllFiles() {- return async (dispatch: Dispatch, getState: GetState) => {+ return async (dispatch: AppDispatch, getState: GetRootState) => {const budgets = await send('get-budgets');const files = await send('get-remote-files');@@ -49,7 +49,7 @@ export function loadAllFiles() {}export function loadBudget(id: string, options = {}) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {dispatch(setAppState({ loadingText: t('Loading...') }));// Loading a budget may fail@@ -90,7 +90,7 @@ export function loadBudget(id: string, options = {}) {}export function closeBudget() {- return async (dispatch: Dispatch, getState: GetState) => {+ return async (dispatch: AppDispatch, getState: GetRootState) => {const prefs = getState().prefs.local;if (prefs && prefs.id) {// This clears out all the app state so the user starts fresh@@ -107,7 +107,7 @@ export function closeBudget() {}export function closeBudgetUI() {- return async (dispatch: Dispatch, getState: GetState) => {+ return async (dispatch: AppDispatch, getState: GetRootState) => {const prefs = getState().prefs.local;if (prefs && prefs.id) {dispatch({ type: constants.CLOSE_BUDGET });@@ -116,14 +116,14 @@ export function closeBudgetUI() {}export function deleteBudget(id?: string, cloudFileId?: string) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {await send('delete-budget', { id, cloudFileId });await dispatch(loadAllFiles());};}export function createBudget({ testMode = false, demoMode = false } = {}) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {dispatch(setAppState({loadingText:@@ -180,7 +180,7 @@ export function duplicateBudget({*/cloudSync?: boolean;}) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {try {dispatch(setAppState({@@ -219,7 +219,7 @@ export function importBudget(filepath: string,type: Parameters<Handlers['import-budget']>[0]['type'],) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {const { error } = await send('import-budget', { filepath, type });if (error) {throw new Error(error);@@ -232,7 +232,7 @@ export function importBudget(}export function uploadBudget(id: string) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {const { error } = await send('upload-budget', { id });if (error) {return { error };@@ -244,21 +244,21 @@ export function uploadBudget(id: string) {}export function closeAndLoadBudget(fileId: string) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {await dispatch(closeBudget());await dispatch(loadBudget(fileId));};}export function closeAndDownloadBudget(cloudFileId: string) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {await dispatch(closeBudget());dispatch(downloadBudget(cloudFileId, { replace: true }));};}export function downloadBudget(cloudFileId: string, { replace = false } = {}) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {dispatch(setAppState({loadingText: t('Downloading...'),diff --git a/packages/loot-core/src/client/actions/prefs.ts b/packages/loot-core/src/client/actions/prefs.tsindex 21cd7a5d55..a777f39046 100644--- a/packages/loot-core/src/client/actions/prefs.ts+++ b/packages/loot-core/src/client/actions/prefs.ts@@ -6,12 +6,12 @@ import {type SyncedPrefs,} from '../../types/prefs';import * as constants from '../constants';+import { type AppDispatch, type GetRootState } from '../store';import { closeModal } from './modals';-import type { Dispatch, GetState } from './types';export function loadPrefs() {- return async (dispatch: Dispatch, getState: GetState) => {+ return async (dispatch: AppDispatch, getState: GetRootState) => {const prefs = await send('load-prefs');// Remove any modal state if switching between budgets@@ -45,7 +45,7 @@ export function loadPrefs() {}export function savePrefs(prefs: MetadataPrefs) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {await send('save-prefs', prefs);dispatch({type: constants.MERGE_LOCAL_PREFS,@@ -55,7 +55,7 @@ export function savePrefs(prefs: MetadataPrefs) {}export function loadGlobalPrefs() {- return async (dispatch: Dispatch, getState: GetState) => {+ return async (dispatch: AppDispatch, getState: GetRootState) => {const globalPrefs = await send('load-global-prefs');dispatch({type: constants.SET_PREFS,@@ -71,7 +71,7 @@ export function saveGlobalPrefs(prefs: GlobalPrefs,onSaveGlobalPrefs?: () => void,) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {await send('save-global-prefs', prefs);dispatch({type: constants.MERGE_GLOBAL_PREFS,@@ -82,7 +82,7 @@ export function saveGlobalPrefs(}export function saveSyncedPrefs(prefs: SyncedPrefs) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {await Promise.all(Object.entries(prefs).map(([prefName, value]) =>send('preferences/save', {diff --git a/packages/loot-core/src/client/actions/queries.ts b/packages/loot-core/src/client/actions/queries.tsindex 16b62375f5..caa316b824 100644--- a/packages/loot-core/src/client/actions/queries.ts+++ b/packages/loot-core/src/client/actions/queries.ts@@ -5,13 +5,13 @@ import throttle from 'throttleit';import { send } from '../../platform/client/fetch';import { type AccountEntity } from '../../types/models';import * as constants from '../constants';+import { type AppDispatch, type GetRootState } from '../store';import { pushModal } from './modals';import { addNotification, addGenericErrorNotification } from './notifications';-import type { Dispatch, GetState } from './types';export function applyBudgetAction(month, type, args) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {switch (type) {case 'budget-amount':await send('budget/budget-amount', {@@ -151,7 +151,7 @@ export function applyBudgetAction(month, type, args) {}export function getCategories() {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {const categories = await send('get-categories');dispatch({type: constants.LOAD_CATEGORIES,@@ -167,7 +167,7 @@ export function createCategory(isIncome: boolean,hidden: boolean,) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {const id = await send('category-create', {name,groupId,@@ -180,7 +180,7 @@ export function createCategory(}export function deleteCategory(id: string, transferId?: string) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {const { error } = await send('category-delete', { id, transferId });if (error) {@@ -210,28 +210,28 @@ export function deleteCategory(id: string, transferId?: string) {}export function updateCategory(category) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {await send('category-update', category);dispatch(getCategories());};}export function moveCategory(id, groupId, targetId) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {await send('category-move', { id, groupId, targetId });await dispatch(getCategories());};}export function moveCategoryGroup(id, targetId) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {await send('category-group-move', { id, targetId });await dispatch(getCategories());};}export function createGroup(name) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {const id = await send('category-group-create', { name });dispatch(getCategories());return id;@@ -260,7 +260,7 @@ export function deleteGroup(id, transferId?) {}export function getPayees() {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {const payees = await send('payees-get');dispatch({type: constants.LOAD_PAYEES,@@ -271,7 +271,7 @@ export function getPayees() {}export function getCommonPayees() {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {const payees = await send('common-payees-get');dispatch({type: constants.LOAD_COMMON_PAYEES,@@ -282,7 +282,7 @@ export function getCommonPayees() {}export function initiallyLoadPayees() {- return async (dispatch: Dispatch, getState: GetState) => {+ return async (dispatch: AppDispatch, getState: GetRootState) => {if (getState().queries.payees.length === 0) {return dispatch(getPayees());}@@ -290,7 +290,7 @@ export function initiallyLoadPayees() {}export function createPayee(name: string) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {const id = await send('payee-create', { name: name.trim() });dispatch(getPayees());return id;@@ -298,7 +298,7 @@ export function createPayee(name: string) {}export function getAccounts() {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {const accounts = await send('accounts-get');dispatch({ type: constants.LOAD_ACCOUNTS, accounts });return accounts;@@ -306,14 +306,14 @@ export function getAccounts() {}export function updateAccount(account: AccountEntity) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {dispatch({ type: constants.UPDATE_ACCOUNT, account });await send('account-update', account);};}export function createAccount(name, balance, offBudget) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {const id = await send('account-create', { name, balance, offBudget });await dispatch(getAccounts());await dispatch(getPayees());@@ -322,7 +322,7 @@ export function createAccount(name, balance, offBudget) {}export function openAccountCloseModal(accountId) {- return async (dispatch: Dispatch, getState: GetState) => {+ return async (dispatch: AppDispatch, getState: GetRootState) => {const { balance, numTransactions } = await send('account-properties', {id: accountId,});@@ -346,7 +346,7 @@ export function closeAccount(categoryId: string,forced?: boolean,) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {await send('account-close', {id: accountId,transferAccountId,@@ -358,7 +358,7 @@ export function closeAccount(}export function reopenAccount(accountId) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {await send('account-reopen', { id: accountId });dispatch(getAccounts());};diff --git a/packages/loot-core/src/client/actions/sync.ts b/packages/loot-core/src/client/actions/sync.tsindex 0d55026f9e..ca7c341aeb 100644--- a/packages/loot-core/src/client/actions/sync.ts+++ b/packages/loot-core/src/client/actions/sync.ts@@ -1,13 +1,13 @@import { send } from '../../platform/client/fetch';import { getUploadError } from '../../shared/errors';+import { type AppDispatch, type GetRootState } from '../store';import { syncAccounts } from './account';import { pushModal } from './modals';import { loadPrefs } from './prefs';-import type { Dispatch, GetState } from './types';export function resetSync() {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {const { error } = await send('sync-reset');if (error) {@@ -36,7 +36,7 @@ export function resetSync() {}export function sync() {- return async (dispatch: Dispatch, getState: GetState) => {+ return async (dispatch: AppDispatch, getState: GetRootState) => {const prefs = getState().prefs.local;if (prefs && prefs.id) {const result = await send('sync');@@ -53,7 +53,7 @@ export function sync() {}export function syncAndDownload(accountId?: string) {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {// It is *critical* that we sync first because of transaction// reconciliation. We want to get all transactions that other// clients have already made, so that imported transactions can bediff --git a/packages/loot-core/src/client/actions/types.d.ts b/packages/loot-core/src/client/actions/types.d.tsdeleted file mode 100644index ad9e5ee358..0000000000--- a/packages/loot-core/src/client/actions/types.d.ts+++ /dev/null@@ -1,6 +0,0 @@-import type { ThunkDispatch } from 'redux-thunk';--import type { State, Action } from '../state-types';--export type Dispatch = ThunkDispatch<State, never, Action>;-export type GetState = () => State;diff --git a/packages/loot-core/src/client/actions/user.ts b/packages/loot-core/src/client/actions/user.tsindex 6084b4e548..5136f6cf6a 100644--- a/packages/loot-core/src/client/actions/user.ts+++ b/packages/loot-core/src/client/actions/user.ts@@ -1,12 +1,12 @@import { send } from '../../platform/client/fetch';import * as constants from '../constants';+import { type AppDispatch } from '../store';import { loadAllFiles, closeBudget } from './budgets';import { loadGlobalPrefs } from './prefs';-import type { Dispatch } from './types';export function getUserData() {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {const data = await send('subscribe-get-user');dispatch({@@ -18,7 +18,7 @@ export function getUserData() {}export function loggedIn() {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {await dispatch(getUserData());// We want to be careful about how we call loadAllFiles. It will@@ -40,7 +40,7 @@ export function loggedIn() {}export function signOut() {- return async (dispatch: Dispatch) => {+ return async (dispatch: AppDispatch) => {await send('subscribe-sign-out');dispatch(getUserData());diff --git a/packages/loot-core/src/client/constants.ts b/packages/loot-core/src/client/constants.tsindex e4f968a22e..4040687853 100644--- a/packages/loot-core/src/client/constants.ts+++ b/packages/loot-core/src/client/constants.ts@@ -25,8 +25,6 @@ export const ADD_NOTIFICATION = 'ADD_NOTIFICATION';export const REMOVE_NOTIFICATION = 'REMOVE_NOTIFICATION';export const SET_NOTIFICATION_INSET = 'SET_NOTIFICATION_INSET';export const GET_USER_DATA = 'GET_USER_DATA';-export const SET_LAST_UNDO_STATE = 'SET_LAST_UNDO_STATE';-export const SET_LAST_SPLIT_STATE = 'SET_LAST_SPLIT_STATE';export const SET_ACCOUNTS_SYNCING = 'SET_ACCOUNTS_SYNCING';export const ACCOUNT_SYNC_STATUS = 'ACCOUNT_SYNC_STATUS';export const SIGN_OUT = 'SIGN_OUT';diff --git a/packages/loot-core/src/client/reducers/account.ts b/packages/loot-core/src/client/reducers/account.tsindex 37387c5e52..ef9e74121c 100644--- a/packages/loot-core/src/client/reducers/account.ts+++ b/packages/loot-core/src/client/reducers/account.ts@@ -2,8 +2,8 @@ import * as constants from '../constants';import type { Action } from '../state-types';import type { AccountState } from '../state-types/account';-const initialState: AccountState = {- failedAccounts: new Map(),+export const initialState: AccountState = {+ failedAccounts: {},accountsSyncing: [],};@@ -15,14 +15,14 @@ export function update(state = initialState, action: Action): AccountState {accountsSyncing: action.ids,};case constants.ACCOUNT_SYNC_STATUS: {- const failedAccounts = new Map(state.failedAccounts);+ const failedAccounts = { ...state.failedAccounts };if (action.failed) {- failedAccounts.set(action.id, {+ failedAccounts[action.id] = {type: action.errorType,code: action.errorCode,- });+ };} else {- failedAccounts.delete(action.id);+ delete failedAccounts[action.id];}return { ...state, failedAccounts };diff --git a/packages/loot-core/src/client/reducers/app.ts b/packages/loot-core/src/client/reducers/app.tsindex 19d4f73d6b..db1161f12c 100644--- a/packages/loot-core/src/client/reducers/app.ts+++ b/packages/loot-core/src/client/reducers/app.ts@@ -7,8 +7,6 @@ export const initialState: AppState = {updateInfo: null,showUpdateNotification: true,managerHasInitialized: false,- lastUndoState: { current: null },- lastSplitState: { current: null },};export function update(state = initialState, action: Action): AppState {@@ -18,17 +16,6 @@ export function update(state = initialState, action: Action): AppState {...state,...action.state,};- case constants.SET_LAST_UNDO_STATE:- // Intentionally mutate it. Components should never rerender- // looking at this, so we put it in a "box" like a ref. They- // only ever need to look at this on mount.- state.lastUndoState.current = action.undoState;- return state;-- case constants.SET_LAST_SPLIT_STATE:- state.lastSplitState.current = action.splitState;- return state;-default:}return state;diff --git a/packages/loot-core/src/client/reducers/budgets.ts b/packages/loot-core/src/client/reducers/budgets.tsindex 70d9f535f1..fad8eb9e19 100644--- a/packages/loot-core/src/client/reducers/budgets.ts+++ b/packages/loot-core/src/client/reducers/budgets.ts@@ -129,7 +129,7 @@ function reconcileFiles(.concat(sorted.filter(f => f.state === 'broken'));}-const initialState: BudgetsState = {+export const initialState: BudgetsState = {budgets: [],remoteFiles: null,allFiles: null,diff --git a/packages/loot-core/src/client/reducers/modals.ts b/packages/loot-core/src/client/reducers/modals.tsindex d0e6840fb0..89f882f49c 100644--- a/packages/loot-core/src/client/reducers/modals.ts+++ b/packages/loot-core/src/client/reducers/modals.ts@@ -2,7 +2,7 @@ import * as constants from '../constants';import type { Action } from '../state-types';import type { ModalsState } from '../state-types/modals';-const initialState: ModalsState = {+export const initialState: ModalsState = {modalStack: [],isHidden: false,};diff --git a/packages/loot-core/src/client/reducers/notifications.ts b/packages/loot-core/src/client/reducers/notifications.tsindex b1dd868d9b..a42efea911 100644--- a/packages/loot-core/src/client/reducers/notifications.ts+++ b/packages/loot-core/src/client/reducers/notifications.ts@@ -3,7 +3,7 @@ import * as constants from '../constants';import type { Action } from '../state-types';import type { NotificationsState } from '../state-types/notifications';-const initialState = {+export const initialState = {notifications: [],inset: {},};diff --git a/packages/loot-core/src/client/reducers/prefs.ts b/packages/loot-core/src/client/reducers/prefs.tsindex 108c9eb551..dd2c865993 100644--- a/packages/loot-core/src/client/reducers/prefs.ts+++ b/packages/loot-core/src/client/reducers/prefs.ts@@ -2,7 +2,7 @@ import * as constants from '../constants';import type { Action } from '../state-types';import type { PrefsState } from '../state-types/prefs';-const initialState: PrefsState = {+export const initialState: PrefsState = {local: {},global: {},synced: {},diff --git a/packages/loot-core/src/client/reducers/queries.ts b/packages/loot-core/src/client/reducers/queries.tsindex b95214d0b0..0ef1d87107 100644--- a/packages/loot-core/src/client/reducers/queries.ts+++ b/packages/loot-core/src/client/reducers/queries.ts@@ -7,7 +7,7 @@ import * as constants from '../constants';import type { Action } from '../state-types';import type { QueriesState } from '../state-types/queries';-const initialState: QueriesState = {+export const initialState: QueriesState = {newTransactions: [],matchedTransactions: [],lastTransaction: null,diff --git a/packages/loot-core/src/client/reducers/user.ts b/packages/loot-core/src/client/reducers/user.tsindex fe715884be..03c1746034 100644--- a/packages/loot-core/src/client/reducers/user.ts+++ b/packages/loot-core/src/client/reducers/user.ts@@ -1,7 +1,7 @@import * as constants from '../constants';import type { UserActions, UserState } from '../state-types/user';-const initialState: UserState = {+export const initialState: UserState = {data: null,};diff --git a/packages/loot-core/src/client/state-types/account.d.ts b/packages/loot-core/src/client/state-types/account.d.tsindex 5abad2a6df..87b16a8698 100644--- a/packages/loot-core/src/client/state-types/account.d.ts+++ b/packages/loot-core/src/client/state-types/account.d.ts@@ -1,7 +1,7 @@import type * as constants from '../constants';export type AccountState = {- failedAccounts: Map<string, { type: string; code: string }>;+ failedAccounts: { [key: string]: { type: string; code: string } };accountsSyncing: string[];};diff --git a/packages/loot-core/src/client/state-types/app.d.ts b/packages/loot-core/src/client/state-types/app.d.tsindex fd4e4f3441..c0923f568c 100644--- a/packages/loot-core/src/client/state-types/app.d.ts+++ b/packages/loot-core/src/client/state-types/app.d.ts@@ -1,13 +1,5 @@-import type { UndoState } from '../../server/undo';import type * as constants from '../constants';-export type SplitMode = 'collapse' | 'expand';-export type SplitState = {- ids: Set<string>;- mode: SplitMode;- transitionId: string | null;-};-export type AppState = {loadingText: string | null;updateInfo: {@@ -17,8 +9,6 @@ export type AppState = {} | null;showUpdateNotification: boolean;managerHasInitialized: boolean;- lastUndoState: { current: UndoState | null };- lastSplitState: { current: SplitState | null };};export type SetAppStateAction = {@@ -26,17 +16,4 @@ export type SetAppStateAction = {state: Partial<AppState>;};-export type SetLastUndoStateAction = {- type: typeof constants.SET_LAST_UNDO_STATE;- undoState: UndoState | null;-};--export type SetLastSplitStateAction = {- type: typeof constants.SET_LAST_SPLIT_STATE;- splitState: SplitState | null;-};--export type AppActions =- | SetAppStateAction- | SetLastUndoStateAction- | SetLastSplitStateAction;+export type AppActions = SetAppStateAction;diff --git a/packages/loot-core/src/client/state-types/index.d.ts b/packages/loot-core/src/client/state-types/index.d.tsindex 382bbcf83f..ffc435f33a 100644--- a/packages/loot-core/src/client/state-types/index.d.ts+++ b/packages/loot-core/src/client/state-types/index.d.ts@@ -34,8 +34,3 @@ export type State = {queries: QueriesState;user: UserState;};--declare module 'react-redux' {- // eslint-disable-next-line @typescript-eslint/no-empty-object-type, @typescript-eslint/consistent-type-definitions- export interface DefaultRootState extends State {}-}diff --git a/packages/loot-core/src/client/store/index.ts b/packages/loot-core/src/client/store/index.tsnew file mode 100644index 0000000000..12f1f2e4d3--- /dev/null+++ b/packages/loot-core/src/client/store/index.ts@@ -0,0 +1,53 @@+import { combineReducers, configureStore } from '@reduxjs/toolkit';++import * as constants from '../constants';+import { reducers } from '../reducers';+import { initialState as initialAccountState } from '../reducers/account';+import { initialState as initialAppState } from '../reducers/app';+import { initialState as initialBudgetsState } from '../reducers/budgets';+import { initialState as initialModalsState } from '../reducers/modals';+import { initialState as initialNotificationsState } from '../reducers/notifications';+import { initialState as initialPrefsState } from '../reducers/prefs';+import { initialState as initialQueriesState } from '../reducers/queries';+import { initialState as initialUserState } from '../reducers/user';++const appReducer = combineReducers(reducers);+const rootReducer: typeof appReducer = (state, action) => {+ if (action.type === constants.CLOSE_BUDGET) {+ // Reset the state and only keep around things intentionally. This+ // blows away everything else+ state = {+ account: initialAccountState,+ modals: initialModalsState,+ notifications: initialNotificationsState,+ queries: initialQueriesState,+ budgets: state?.budgets || initialBudgetsState,+ user: state?.user || initialUserState,+ prefs: {+ local: initialPrefsState.local,+ global: state?.prefs?.global || initialPrefsState.global,+ synced: initialPrefsState.synced,+ },+ app: {+ ...initialAppState,+ managerHasInitialized: state?.app?.managerHasInitialized || false,+ loadingText: state?.app?.loadingText || null,+ },+ };+ }++ return appReducer(state, action);+};++export const store = configureStore({+ reducer: rootReducer,+ middleware: getDefaultMiddleware =>+ getDefaultMiddleware({+ // TODO: Fix this in a separate PR. Remove non-serializable states in the store.+ serializableCheck: false,+ }),+});++export type RootState = ReturnType<typeof store.getState>;+export type AppDispatch = typeof store.dispatch;+export type GetRootState = typeof store.getState;diff --git a/packages/loot-core/src/client/store/mock.ts b/packages/loot-core/src/client/store/mock.tsnew file mode 100644index 0000000000..a232a9c566--- /dev/null+++ b/packages/loot-core/src/client/store/mock.ts@@ -0,0 +1,17 @@+import { configureStore, combineReducers } from '@reduxjs/toolkit';++import { reducers } from '../reducers';++import { type store as realStore } from './index';++const appReducer = combineReducers(reducers);++export let mockStore: typeof realStore = configureStore({+ reducer: appReducer,+});++export function resetMockStore() {+ mockStore = configureStore({+ reducer: appReducer,+ });+}diff --git a/packages/loot-core/src/mocks/redux.tsx b/packages/loot-core/src/mocks/redux.tsxdeleted file mode 100644index 0722bbff90..0000000000--- a/packages/loot-core/src/mocks/redux.tsx+++ /dev/null@@ -1,21 +0,0 @@-// @ts-strict-ignore-import React from 'react';-import { Provider } from 'react-redux';--import { createStore, combineReducers, applyMiddleware } from 'redux';-import thunk from 'redux-thunk';--import { reducers } from '../client/reducers';--const appReducer = combineReducers(reducers);-let store = null;--export function resetStore() {- store = createStore(appReducer, undefined, applyMiddleware(thunk /* log */));-}--resetStore();--export function TestProvider({ children }) {- return <Provider store={store}>{children}</Provider>;-}diff --git a/packages/loot-core/src/platform/client/undo/index.d.ts b/packages/loot-core/src/platform/client/undo/index.d.tsindex 18090c47d9..759474e48b 100644--- a/packages/loot-core/src/platform/client/undo/index.d.ts+++ b/packages/loot-core/src/platform/client/undo/index.d.ts@@ -1,14 +1,17 @@-// eslint-disable-next-line import/no-unresolved-import { type ModalType } from '../../client/state-types/modals';+import { OptionlessModal } from '../../../client/state-types/modals';+import { UndoState as ServerUndoState } from '../../../server/undo';export type UndoState = {- id?: string;- url: unknown;- openModal: ModalType;+ url: string | null;+ // Right now, only the payees page uses this. It's only being set to+ // `manage-rules` which is an optionless modal. Do we want to also+ // support modals with options?+ openModal: OptionlessModal | null;selectedItems: {name: string;items: Set<string>;} | null;+ undoEvent: ServerUndoState | null;};export function setUndoState<K extends keyof Omit<UndoState, 'id'>>(diff --git a/packages/loot-core/src/platform/client/undo/index.web.ts b/packages/loot-core/src/platform/client/undo/index.web.tsindex 15c3300b07..39dde9ac0c 100644--- a/packages/loot-core/src/platform/client/undo/index.web.ts+++ b/packages/loot-core/src/platform/client/undo/index.web.ts@@ -2,15 +2,20 @@ import { v4 as uuidv4 } from 'uuid';import type * as T from '.';+type UndoStateWithId = T.UndoState & {+ id?: ReturnType<typeof uuidv4>;+};+// List of recently used states. We don't use a true MRU structure// because our needs are simple and we also do some custom reordering.const HISTORY_SIZE = 40;-let UNDO_STATE_MRU: T.UndoState[] = [];+let UNDO_STATE_MRU: UndoStateWithId[] = [];-const currentUndoState: T.UndoState = {+const currentUndoState: UndoStateWithId = {url: null,openModal: null,selectedItems: null,+ undoEvent: null,};export const setUndoState: T.SetUndoState = function (name, value) {diff --git a/upcoming-release-notes/4000.md b/upcoming-release-notes/4000.mdnew file mode 100644index 0000000000..97d68b9b6b--- /dev/null+++ b/upcoming-release-notes/4000.md@@ -0,0 +1,6 @@+---+category: Maintenance+authors: [joel-jeremy]+---++Phase 1 - Migrate to modern redux toolkit APIsdiff --git a/yarn.lock b/yarn.lockindex 5f72026d30..5f60a12065 100644--- a/yarn.lock+++ b/yarn.lock@@ -77,7 +77,6 @@ __metadata:"@types/react-dom": "npm:^18.2.1""@types/react-grid-layout": "npm:^1""@types/react-modal": "npm:^3.16.0"- "@types/react-redux": "npm:^7.1.25""@types/uuid": "npm:^9.0.2""@types/webpack-bundle-analyzer": "npm:^4.6.3""@use-gesture/react": "npm:^10.3.0"@@ -114,15 +113,13 @@ __metadata:react-i18next: "npm:^14.1.2"react-markdown: "npm:^8.0.7"react-modal: "npm:3.16.1"- react-redux: "npm:7.2.9"+ react-redux: "npm:^9.2.0"react-router-dom: "npm:6.21.3"react-simple-pull-to-refresh: "npm:^1.3.3"react-spring: "npm:^9.7.3"react-stately: "npm:^3.33.0"react-virtualized-auto-sizer: "npm:^1.0.21"recharts: "npm:^2.10.4"- redux: "npm:^4.2.1"- redux-thunk: "npm:^2.4.2"remark-gfm: "npm:^3.0.1"rollup-plugin-visualizer: "npm:^5.12.0"sass: "npm:^1.70.0"@@ -1461,7 +1458,7 @@ __metadata:languageName: nodelinkType: hard-"@babel/runtime@npm:^7.1.2, @babel/runtime@npm:^7.11.2, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.14.8, @babel/runtime@npm:^7.15.4, @babel/runtime@npm:^7.18.3, @babel/runtime@npm:^7.21.0, @babel/runtime@npm:^7.23.2, @babel/runtime@npm:^7.23.9, @babel/runtime@npm:^7.8.4, @babel/runtime@npm:^7.9.2":+"@babel/runtime@npm:^7.1.2, @babel/runtime@npm:^7.11.2, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.14.8, @babel/runtime@npm:^7.18.3, @babel/runtime@npm:^7.21.0, @babel/runtime@npm:^7.23.2, @babel/runtime@npm:^7.23.9, @babel/runtime@npm:^7.8.4, @babel/runtime@npm:^7.9.2":version: 7.25.6resolution: "@babel/runtime@npm:7.25.6"dependencies:@@ -4590,6 +4587,26 @@ __metadata:languageName: nodelinkType: hard+"@reduxjs/toolkit@npm:^2.5.0":+ version: 2.5.0+ resolution: "@reduxjs/toolkit@npm:2.5.0"+ dependencies:+ immer: "npm:^10.0.3"+ redux: "npm:^5.0.1"+ redux-thunk: "npm:^3.1.0"+ reselect: "npm:^5.1.0"+ peerDependencies:+ react: ^16.9.0 || ^17.0.0 || ^18 || ^19+ react-redux: ^7.2.1 || ^8.1.3 || ^9.0.0+ peerDependenciesMeta:+ react:+ optional: true+ react-redux:+ optional: true+ checksum: 10/b24ee7e89bd00c5f3ee5df12cbc1b6395784ff215b9bf75d2c1b211d8494af220057ced666f49c6e815b723252bc3eb704f7be4a3c261ab06ee7b776f4565d4b+ languageName: node+ linkType: hard+"@remix-run/router@npm:1.14.2":version: 1.14.2resolution: "@remix-run/router@npm:1.14.2"@@ -5571,16 +5588,6 @@ __metadata:languageName: nodelinkType: hard-"@types/hoist-non-react-statics@npm:^3.3.0":- version: 3.3.1- resolution: "@types/hoist-non-react-statics@npm:3.3.1"- dependencies:- "@types/react": "npm:*"- hoist-non-react-statics: "npm:^3.3.0"- checksum: 10/071e6d75a0ed9aa0e9ca2cc529a8c15bf7ac3e4a37aac279772ea6036fd0bf969b67fb627b65cfce65adeab31fec1e9e95b4dcdefeab075b580c0c7174206f63- languageName: node- linkType: hard-"@types/http-cache-semantics@npm:*":version: 4.0.1resolution: "@types/http-cache-semantics@npm:4.0.1"@@ -5794,18 +5801,6 @@ __metadata:languageName: nodelinkType: hard-"@types/react-redux@npm:^7.1.20, @types/react-redux@npm:^7.1.25":- version: 7.1.33- resolution: "@types/react-redux@npm:7.1.33"- dependencies:- "@types/hoist-non-react-statics": "npm:^3.3.0"- "@types/react": "npm:*"- hoist-non-react-statics: "npm:^3.3.0"- redux: "npm:^4.0.0"- checksum: 10/65f4e0a3f0e532bbbe44ae6522d1fce91bfcb3bacc90904c35d3f819e77932cc489b6945988acb4a2320f6e78c57dd1c149556aa241a68efc51de15a2cd73fc0- languageName: node- linkType: hard-"@types/react@npm:*, @types/react@npm:^18.2.0":version: 18.2.0resolution: "@types/react@npm:18.2.0"@@ -5882,6 +5877,13 @@ __metadata:languageName: nodelinkType: hard+"@types/use-sync-external-store@npm:^0.0.6":+ version: 0.0.6+ resolution: "@types/use-sync-external-store@npm:0.0.6"+ checksum: 10/a95ce330668501ad9b1c5b7f2b14872ad201e552a0e567787b8f1588b22c7040c7c3d80f142cbb9f92d13c4ea41c46af57a20f2af4edf27f224d352abcfe4049+ languageName: node+ linkType: hard+"@types/uuid@npm:^9.0.2":version: 9.0.2resolution: "@types/uuid@npm:9.0.2"@@ -11501,7 +11503,7 @@ __metadata:languageName: nodelinkType: hard-"hoist-non-react-statics@npm:^3.3.0, hoist-non-react-statics@npm:^3.3.2":+"hoist-non-react-statics@npm:^3.3.2":version: 3.3.2resolution: "hoist-non-react-statics@npm:3.3.2"dependencies:@@ -11745,6 +11747,13 @@ __metadata:languageName: nodelinkType: hard+"immer@npm:^10.0.3":+ version: 10.1.1+ resolution: "immer@npm:10.1.1"+ checksum: 10/9dacf1e8c201d69191ccd88dc5d733bafe166cd45a5a360c5d7c88f1de0dff974a94114d72b35f3106adfe587fcfb131c545856184a2247d89d735ad25589863+ languageName: node+ linkType: hard+"immutable@npm:^4.0.0":version: 4.3.0resolution: "immutable@npm:4.3.0"@@ -13806,6 +13815,7 @@ __metadata:"@actual-app/api": "npm:*""@actual-app/crdt": "npm:*""@jlongster/sql.js": "npm:^1.6.7"+ "@reduxjs/toolkit": "npm:^2.5.0""@rschedule/core": "npm:^1.5.0""@rschedule/json-tools": "npm:^1.5.0""@rschedule/standard-date-adapter": "npm:^1.5.0"@@ -13817,7 +13827,6 @@ __metadata:"@types/jest": "npm:^27.5.2""@types/jlongster__sql.js": "npm:@types/sql.js@latest""@types/pegjs": "npm:^0.10.3"- "@types/react-redux": "npm:^7.1.25""@types/uuid": "npm:^9.0.2""@types/webpack": "npm:^5.28.5""@types/webpack-bundle-analyzer": "npm:^4.6.3"@@ -16513,24 +16522,22 @@ __metadata:languageName: nodelinkType: hard-"react-redux@npm:7.2.9":- version: 7.2.9- resolution: "react-redux@npm:7.2.9"+"react-redux@npm:^9.2.0":+ version: 9.2.0+ resolution: "react-redux@npm:9.2.0"dependencies:- "@babel/runtime": "npm:^7.15.4"- "@types/react-redux": "npm:^7.1.20"- hoist-non-react-statics: "npm:^3.3.2"- loose-envify: "npm:^1.4.0"- prop-types: "npm:^15.7.2"- react-is: "npm:^17.0.2"+ "@types/use-sync-external-store": "npm:^0.0.6"+ use-sync-external-store: "npm:^1.4.0"peerDependencies:- react: ^16.8.3 || ^17 || ^18+ "@types/react": ^18.2.25 || ^19+ react: ^18.0 || ^19+ redux: ^5.0.0peerDependenciesMeta:- react-dom:+ "@types/react":optional: true- react-native:+ redux:optional: true- checksum: 10/1c3018bd2601e6d18339281867910b583dcbb3d8856403086e08c00abf0dfe467a94c0d1356bafa8cdf107bf1e2c9899a28486e4778e85c8bc4dfed2076b116f+ checksum: 10/b3d2f89f469169475ab0a9f8914d54a336ac9bc6a31af6e8dcfe9901e6fe2cfd8c1a3f6ce7a2f7f3e0928a93fbab833b668804155715598b7f2ad89927d3ff50languageName: nodelinkType: hard@@ -16812,16 +16819,16 @@ __metadata:languageName: nodelinkType: hard-"redux-thunk@npm:^2.4.2":- version: 2.4.2- resolution: "redux-thunk@npm:2.4.2"+"redux-thunk@npm:^3.1.0":+ version: 3.1.0+ resolution: "redux-thunk@npm:3.1.0"peerDependencies:- redux: ^4- checksum: 10/9bcb1193835128ecebf1e1a1b1a37bc15e8dfbdf6b6ee1b5566dd4c8e4ca05a81175f0c6dda34ab47f87053cd13b74d9f881d59446691d7b192831852b5d7a72+ redux: ^5.0.0+ checksum: 10/38c563db5f0bbec90d2e65cc27f3c870c1b6102e0c071258734fac41cb0e51d31d894125815c2f4133b20aff231f51f028ad99bccc05a7e3249f1a5d5a959ed3languageName: nodelinkType: hard-"redux@npm:^4.0.0, redux@npm:^4.2.0, redux@npm:^4.2.1":+"redux@npm:^4.2.0":version: 4.2.1resolution: "redux@npm:4.2.1"dependencies:@@ -16830,6 +16837,13 @@ __metadata:languageName: nodelinkType: hard+"redux@npm:^5.0.1":+ version: 5.0.1+ resolution: "redux@npm:5.0.1"+ checksum: 10/a373f9ed65693ead58bea5ef61c1d6bef39da9f2706db3be6f84815f3a1283230ecd1184efb1b3daa7f807d8211b0181564ca8f336fc6ee0b1e2fa0ba06737c2+ languageName: node+ linkType: hard+"reflect.getprototypeof@npm:^1.0.8":version: 1.0.8resolution: "reflect.getprototypeof@npm:1.0.8"@@ -17018,6 +17032,13 @@ __metadata:languageName: nodelinkType: hard+"reselect@npm:^5.1.0":+ version: 5.1.1+ resolution: "reselect@npm:5.1.1"+ checksum: 10/1fdae11a39ed9c8d85a24df19517c8372ee24fefea9cce3fae9eaad8e9cefbba5a3d4940c6fe31296b6addf76e035588c55798f7e6e147e1b7c0855f119e7fa5+ languageName: node+ linkType: hard+"resize-observer-polyfill@npm:^1.5.1":version: 1.5.1resolution: "resize-observer-polyfill@npm:1.5.1"@@ -19450,6 +19471,15 @@ __metadata:languageName: nodelinkType: hard+"use-sync-external-store@npm:^1.4.0":+ version: 1.4.0+ resolution: "use-sync-external-store@npm:1.4.0"+ peerDependencies:+ react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0+ checksum: 10/08bf581a8a2effaefc355e9d18ed025d436230f4cc973db2f593166df357cf63e47b9097b6e5089b594758bde322e1737754ad64905e030d70f8ff7ee671fd01+ languageName: node+ linkType: hard+"usehooks-ts@npm:^3.0.1":version: 3.0.1resolution: "usehooks-ts@npm:3.0.1"