Skip to content

Commit

Permalink
Delete constants
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-jeremy committed Jan 17, 2025
1 parent d0681cc commit 4d6edf4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 26 deletions.
6 changes: 3 additions & 3 deletions packages/loot-core/src/client/budgets/budgetsSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import { type Budget } from '../../types/budget';
import { type File } from '../../types/file';
import { type Handlers } from '../../types/handlers';
import { setAppState } from '../app/appSlice';
import * as constants from '../constants';
import { closeModal, pushModal } from '../modals/modalsSlice';
import { loadGlobalPrefs, loadPrefs } from '../prefs/prefsSlice';
import { createAppAsyncThunk } from '../redux';
import { signOut } from '../users/usersSlice';
import { CLOSE_BUDGET } from '../store';

Check warning on line 15 in packages/loot-core/src/client/budgets/budgetsSlice.ts

View workflow job for this annotation

GitHub Actions / lint

`../store` import should occur before import of `../users/usersSlice`

const sliceName = 'budgets';

Expand Down Expand Up @@ -104,7 +104,7 @@ export const closeBudget = createAppAsyncThunk(
if (prefs && prefs.id) {
// This clears out all the app state so the user starts fresh
// TODO: Change to use an action once CLOSE_BUDGET is migrated to redux toolkit.
await dispatch({ type: constants.CLOSE_BUDGET });
await dispatch({ type: CLOSE_BUDGET });

await dispatch(setAppState({ loadingText: t('Closing...') }));
await send('close-budget');
Expand All @@ -122,7 +122,7 @@ export const closeBudgetUI = createAppAsyncThunk(
const prefs = getState().prefs.local;
if (prefs && prefs.id) {
// TODO: Change to use an action once CLOSE_BUDGET is migrated to redux toolkit.
await dispatch({ type: constants.CLOSE_BUDGET });
await dispatch({ type: CLOSE_BUDGET });
}
},
);
Expand Down
21 changes: 0 additions & 21 deletions packages/loot-core/src/client/constants.ts

This file was deleted.

6 changes: 4 additions & 2 deletions packages/loot-core/src/client/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
reducer as budgetsSliceReducer,
getInitialState as getInitialBudgetsState,
} from '../budgets/budgetsSlice';
import * as constants from '../constants';
import {
name as modalsSliceName,
reducer as modalsSliceReducer,
Expand Down Expand Up @@ -58,8 +57,11 @@ const appReducer = combineReducers({
[queriesSliceName]: queriesSliceReducer,
[usersSliceName]: usersSliceReducer,
});

export const CLOSE_BUDGET = 'CLOSE_BUDGET';

const rootReducer: typeof appReducer = (state, action) => {
if (action.type === constants.CLOSE_BUDGET) {
if (action.type === CLOSE_BUDGET) {
// Reset the state and only keep around things intentionally. This
// blows away everything else
state = {
Expand Down

0 comments on commit 4d6edf4

Please sign in to comment.