Skip to content

A local-first personal finance app

Move loot-core/client codes over to desktop-client package (#4816)

Joel Jeremy Marquez7064106748e1
diff --git a/packages/loot-core/src/client/accounts/accountsSlice.ts b/packages/desktop-client/src/accounts/accountsSlice.ts
similarity index 95%
rename from packages/loot-core/src/client/accounts/accountsSlice.ts
rename to packages/desktop-client/src/accounts/accountsSlice.ts
index d79737d5fb..a20c5a9c74 100644
--- a/packages/loot-core/src/client/accounts/accountsSlice.ts
+++ b/packages/desktop-client/src/accounts/accountsSlice.ts
@@ -1,23 +1,23 @@
import { createSlice, type PayloadAction } from '@reduxjs/toolkit';
-import { send } from '../../platform/client/fetch';
-import { type SyncResponseWithErrors } from '../../server/accounts/app';
+import { resetApp } from 'loot-core/client/app/appSlice';
+import { addNotification } from 'loot-core/client/notifications/notificationsSlice';
+import {
+ getAccounts,
+ getPayees,
+ setNewTransactions,
+} from 'loot-core/client/queries/queriesSlice';
+import { createAppAsyncThunk } from 'loot-core/client/redux';
+import { type AppDispatch } from 'loot-core/client/store';
+import { send } from 'loot-core/platform/client/fetch';
+import { type SyncResponseWithErrors } from 'loot-core/server/accounts/app';
import {
type SyncServerGoCardlessAccount,
type AccountEntity,
type TransactionEntity,
type SyncServerSimpleFinAccount,
type SyncServerPluggyAiAccount,
-} from '../../types/models';
-import { resetApp } from '../app/appSlice';
-import { addNotification } from '../notifications/notificationsSlice';
-import {
- getAccounts,
- getPayees,
- setNewTransactions,
-} from '../queries/queriesSlice';
-import { createAppAsyncThunk } from '../redux';
-import { type AppDispatch } from '../store';
+} from 'loot-core/types/models';
const sliceName = 'account';
diff --git a/packages/desktop-client/src/components/accounts/Account.tsx b/packages/desktop-client/src/components/accounts/Account.tsx
index 689067e791..dc0a9350bd 100644
--- a/packages/desktop-client/src/components/accounts/Account.tsx
+++ b/packages/desktop-client/src/components/accounts/Account.tsx
@@ -16,7 +16,6 @@ import { debounce } from 'debounce';
import { t } from 'i18next';
import { v4 as uuidv4 } from 'uuid';
-import { unlinkAccount } from 'loot-core/client/accounts/accountsSlice';
import { syncAndDownload } from 'loot-core/client/app/appSlice';
import { useFilters } from 'loot-core/client/data-hooks/filters';
import {
@@ -67,6 +66,7 @@ import {
type TransactionFilterEntity,
} from 'loot-core/types/models';
+import { unlinkAccount } from '../../accounts/accountsSlice';
import { useAccountPreviewTransactions } from '../../hooks/useAccountPreviewTransactions';
import { useAccounts } from '../../hooks/useAccounts';
import { useCategories } from '../../hooks/useCategories';
diff --git a/packages/desktop-client/src/components/accounts/AccountSyncCheck.tsx b/packages/desktop-client/src/components/accounts/AccountSyncCheck.tsx
index 457a9b0dfa..2eb33d9c32 100644
--- a/packages/desktop-client/src/components/accounts/AccountSyncCheck.tsx
+++ b/packages/desktop-client/src/components/accounts/AccountSyncCheck.tsx
@@ -8,9 +8,9 @@ import { Popover } from '@actual-app/components/popover';
import { theme } from '@actual-app/components/theme';
import { View } from '@actual-app/components/view';
-import { unlinkAccount } from 'loot-core/client/accounts/accountsSlice';
import { type AccountEntity } from 'loot-core/types/models';
+import { unlinkAccount } from '../../accounts/accountsSlice';
import { authorizeBank } from '../../gocardless';
import { useAccounts } from '../../hooks/useAccounts';
import { useFailedAccounts } from '../../hooks/useFailedAccounts';
diff --git a/packages/desktop-client/src/components/banksync/EditSyncAccount.tsx b/packages/desktop-client/src/components/banksync/EditSyncAccount.tsx
index b45208740d..f9fe938c3d 100644
--- a/packages/desktop-client/src/components/banksync/EditSyncAccount.tsx
+++ b/packages/desktop-client/src/components/banksync/EditSyncAccount.tsx
@@ -9,7 +9,6 @@ import { theme } from '@actual-app/components/theme';
import { Tooltip } from '@actual-app/components/tooltip';
import { View } from '@actual-app/components/view';
-import { unlinkAccount } from 'loot-core/client/accounts/accountsSlice';
import { useTransactions } from 'loot-core/client/data-hooks/transactions';
import { pushModal } from 'loot-core/client/modals/modalsSlice';
import {
@@ -24,6 +23,7 @@ import {
type AccountEntity,
} from 'loot-core/types/models';
+import { unlinkAccount } from '../../accounts/accountsSlice';
import { useSyncedPref } from '../../hooks/useSyncedPref';
import { useDispatch } from '../../redux';
import { Modal, ModalCloseButton, ModalHeader } from '../common/Modal';
diff --git a/packages/desktop-client/src/components/mobile/accounts/Accounts.tsx b/packages/desktop-client/src/components/mobile/accounts/Accounts.tsx
index b0fd5cd746..fbc6d5f7db 100644
--- a/packages/desktop-client/src/components/mobile/accounts/Accounts.tsx
+++ b/packages/desktop-client/src/components/mobile/accounts/Accounts.tsx
@@ -27,12 +27,12 @@ import { theme } from '@actual-app/components/theme';
import { View } from '@actual-app/components/view';
import { css } from '@emotion/css';
-import { moveAccount } from 'loot-core/client/accounts/accountsSlice';
import { syncAndDownload } from 'loot-core/client/app/appSlice';
import { replaceModal } from 'loot-core/client/modals/modalsSlice';
import * as queries from 'loot-core/client/queries';
import { type AccountEntity } from 'loot-core/types/models';
+import { moveAccount } from '../../../accounts/accountsSlice';
import { useAccounts } from '../../../hooks/useAccounts';
import { useFailedAccounts } from '../../../hooks/useFailedAccounts';
import { useLocalPref } from '../../../hooks/useLocalPref';
diff --git a/packages/desktop-client/src/components/modals/SelectLinkedAccountsModal.jsx b/packages/desktop-client/src/components/modals/SelectLinkedAccountsModal.jsx
index a15e23b3b7..45b0e2343b 100644
--- a/packages/desktop-client/src/components/modals/SelectLinkedAccountsModal.jsx
+++ b/packages/desktop-client/src/components/modals/SelectLinkedAccountsModal.jsx
@@ -7,14 +7,14 @@ import { theme } from '@actual-app/components/theme';
import { Tooltip } from '@actual-app/components/tooltip';
import { View } from '@actual-app/components/view';
+import { closeModal } from 'loot-core/client/modals/modalsSlice';
+
import {
linkAccount,
linkAccountPluggyAi,
linkAccountSimpleFin,
unlinkAccount,
-} from 'loot-core/client/accounts/accountsSlice';
-import { closeModal } from 'loot-core/client/modals/modalsSlice';
-
+} from '../../accounts/accountsSlice';
import { useAccounts } from '../../hooks/useAccounts';
import { useDispatch } from '../../redux';
import { Autocomplete } from '../autocomplete/Autocomplete';
diff --git a/packages/desktop-client/src/components/sidebar/Accounts.tsx b/packages/desktop-client/src/components/sidebar/Accounts.tsx
index d76fe2d56e..0e1e62ce03 100644
--- a/packages/desktop-client/src/components/sidebar/Accounts.tsx
+++ b/packages/desktop-client/src/components/sidebar/Accounts.tsx
@@ -4,10 +4,10 @@ import { useTranslation } from 'react-i18next';
import { theme } from '@actual-app/components/theme';
import { View } from '@actual-app/components/view';
-import { moveAccount } from 'loot-core/client/accounts/accountsSlice';
import * as queries from 'loot-core/client/queries';
import { type AccountEntity } from 'loot-core/types/models';
+import { moveAccount } from '../../accounts/accountsSlice';
import { useAccounts } from '../../hooks/useAccounts';
import { useClosedAccounts } from '../../hooks/useClosedAccounts';
import { useFailedAccounts } from '../../hooks/useFailedAccounts';
diff --git a/packages/desktop-client/src/index.tsx b/packages/desktop-client/src/index.tsx
index 188c2895f4..c78e4b9fbe 100644
--- a/packages/desktop-client/src/index.tsx
+++ b/packages/desktop-client/src/index.tsx
@@ -13,7 +13,6 @@ import { Provider } from 'react-redux';
import { bindActionCreators } from '@reduxjs/toolkit';
import { createRoot } from 'react-dom/client';
-import * as accountsSlice from 'loot-core/client/accounts/accountsSlice';
import * as appSlice from 'loot-core/client/app/appSlice';
import * as budgetsSlice from 'loot-core/client/budgets/budgetsSlice';
import * as modalsSlice from 'loot-core/client/modals/modalsSlice';
@@ -27,6 +26,7 @@ import * as usersSlice from 'loot-core/client/users/usersSlice';
import { send } from 'loot-core/platform/client/fetch';
import { q } from 'loot-core/shared/query';
+import * as accountsSlice from './accounts/accountsSlice';
import { AuthProvider } from './auth/AuthProvider';
import { App } from './components/App';
import { ServerProvider } from './components/ServerContext';
diff --git a/packages/loot-core/src/client/app/appSlice.ts b/packages/loot-core/src/client/app/appSlice.ts
index 653dd0a86f..6cb0b8ec03 100644
--- a/packages/loot-core/src/client/app/appSlice.ts
+++ b/packages/loot-core/src/client/app/appSlice.ts
@@ -1,3 +1,6 @@
+// This is temporary until we move all loot-core/client over to desktop-client.
+// eslint-disable-next-line no-restricted-imports
+import { syncAccounts } from '@actual-app/web/src/accounts/accountsSlice';
import {
createAction,
createSlice,
@@ -8,7 +11,6 @@ import { send } from '../../platform/client/fetch';
import { getUploadError } from '../../shared/errors';
import { type AccountEntity } from '../../types/models';
import { type AtLeastOne } from '../../types/util';
-import { syncAccounts } from '../accounts/accountsSlice';
import { pushModal } from '../modals/modalsSlice';
import { loadPrefs } from '../prefs/prefsSlice';
import { createAppAsyncThunk } from '../redux';
diff --git a/packages/loot-core/src/client/store/index.ts b/packages/loot-core/src/client/store/index.ts
index 2cb3ee3fb3..288f4e84b9 100644
--- a/packages/loot-core/src/client/store/index.ts
+++ b/packages/loot-core/src/client/store/index.ts
@@ -1,3 +1,9 @@
+// This is temporary until we move all loot-core/client over to desktop-client.
+// eslint-disable-next-line no-restricted-imports
+import {
+ name as accountsSliceName,
+ reducer as accountsSliceReducer,
+} from '@actual-app/web/src/accounts/accountsSlice';
import {
combineReducers,
configureStore,
@@ -5,10 +11,6 @@ import {
isRejected,
} from '@reduxjs/toolkit';
-import {
- name as accountsSliceName,
- reducer as accountsSliceReducer,
-} from '../accounts/accountsSlice';
import {
name as appSliceName,
reducer as appSliceReducer,
diff --git a/packages/loot-core/src/client/store/mock.ts b/packages/loot-core/src/client/store/mock.ts
index 3961379802..851312329c 100644
--- a/packages/loot-core/src/client/store/mock.ts
+++ b/packages/loot-core/src/client/store/mock.ts
@@ -1,9 +1,11 @@
-import { configureStore, combineReducers } from '@reduxjs/toolkit';
-
+// This is temporary until we move all loot-core/client over to desktop-client.
+// eslint-disable-next-line no-restricted-imports
import {
name as accountsSliceName,
reducer as accountsSliceReducer,
-} from '../accounts/accountsSlice';
+} from '@actual-app/web/src/accounts/accountsSlice';
+import { configureStore, combineReducers } from '@reduxjs/toolkit';
+
import {
name as appSliceName,
reducer as appSliceReducer,
diff --git a/upcoming-release-notes/4816.md b/upcoming-release-notes/4816.md
new file mode 100644
index 0000000000..0b6933657e
--- /dev/null
+++ b/upcoming-release-notes/4816.md
@@ -0,0 +1,6 @@
+---
+category: Maintenance
+authors: [joel-jeremy]
+---
+
+Move loot-core/client codes over to desktop-client package