diff --git a/.eslintrc.js b/.eslintrc.js index 76253271535..c8b0368a03c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -465,7 +465,8 @@ module.exports = { { group: ['react-router-dom'], importNames: ['useNavigate'], - message: 'Please import Actual’s useNavigate() hook from `src/hooks` instead.', + message: + 'Please import Actual’s useNavigate() hook from `src/hooks` instead.', }, ], }, @@ -502,7 +503,8 @@ module.exports = { { group: ['react-redux'], importNames: ['useSelector'], - message: 'Please import Actual’s useSelector() hook from `src/redux` instead.', + message: + 'Please import Actual’s useSelector() hook from `src/redux` instead.', }, ], }, diff --git a/packages/desktop-client/src/components/mobile/accounts/Accounts.tsx b/packages/desktop-client/src/components/mobile/accounts/Accounts.tsx index dbd31298f73..5979cdb1d43 100644 --- a/packages/desktop-client/src/components/mobile/accounts/Accounts.tsx +++ b/packages/desktop-client/src/components/mobile/accounts/Accounts.tsx @@ -3,7 +3,6 @@ import { useTranslation } from 'react-i18next'; import { replaceModal, syncAndDownload } from 'loot-core/src/client/actions'; import * as queries from 'loot-core/src/client/queries'; -import { type RootState } from 'loot-core/src/client/store'; import { type AccountEntity } from 'loot-core/types/models'; import { useAccounts } from '../../../hooks/useAccounts'; diff --git a/packages/loot-core/src/platform/client/undo/index.d.ts b/packages/loot-core/src/platform/client/undo/index.d.ts index 2d45779b37c..759474e48bc 100644 --- a/packages/loot-core/src/platform/client/undo/index.d.ts +++ b/packages/loot-core/src/platform/client/undo/index.d.ts @@ -1,10 +1,12 @@ +import { OptionlessModal } from '../../../client/state-types/modals'; import { UndoState as ServerUndoState } from '../../../server/undo'; -import { type ModalType } from '../../client/state-types/modals'; export type UndoState = { - id?: string; - url: string; - 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; diff --git a/packages/loot-core/src/platform/client/undo/index.web.ts b/packages/loot-core/src/platform/client/undo/index.web.ts index d0de3f64678..39dde9ac0c0 100644 --- a/packages/loot-core/src/platform/client/undo/index.web.ts +++ b/packages/loot-core/src/platform/client/undo/index.web.ts @@ -2,12 +2,16 @@ import { v4 as uuidv4 } from 'uuid'; import type * as T from '.'; +type UndoStateWithId = T.UndoState & { + id?: ReturnType; +}; + // 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,