Skip to content

Commit

Permalink
Remove app state type
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-jeremy committed Jan 6, 2025
1 parent 98d8329 commit dca111d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 26 deletions.
20 changes: 16 additions & 4 deletions packages/loot-core/src/client/reducers/modals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@ export const initialState: ModalsState = {
isHidden: false,
};

export function update(state = initialState, action: Action): ModalsState {
type ModalsAction =
| Action
// Temporary until we migrate to redux toolkit.
| {
type: 'app/setAppState';
payload: { loadingText: string | null };
};

export function update(
state = initialState,
action: ModalsAction,
): ModalsState {
switch (action.type) {
case constants.PUSH_MODAL:
// special case: don't show the keyboard shortcuts modal if there's already a modal open
Expand Down Expand Up @@ -44,11 +55,12 @@ export function update(state = initialState, action: Action): ModalsState {
...state,
modalStack: idx < 0 ? state.modalStack : state.modalStack.slice(0, idx),
};
case constants.SET_APP_STATE:
if ('loadingText' in action.state) {
// Temporary until we migrate to redux toolkit.
case 'app/setAppState':
if (action.payload.loadingText) {
return {
...state,
isHidden: action.state.loadingText != null,
isHidden: action.payload.loadingText != null,
};
}
break;
Expand Down
19 changes: 0 additions & 19 deletions packages/loot-core/src/client/state-types/app.d.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/loot-core/src/client/state-types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type * as constants from '../constants';

import type { AppActions, AppState } from './app';
import type { BudgetsActions, BudgetsState } from './budgets';
import type { ModalsActions, ModalsState } from './modals';
import type { NotificationsActions, NotificationsState } from './notifications';
Expand All @@ -12,7 +11,6 @@ export type CloseBudgetAction = {
};

export type Action =
| AppActions
| BudgetsActions
| ModalsActions
| NotificationsActions
Expand All @@ -21,7 +19,6 @@ export type Action =
| CloseBudgetAction;

export type State = {
app: AppState;
budgets: BudgetsState;
modals: ModalsState;
notifications: NotificationsState;
Expand Down

0 comments on commit dca111d

Please sign in to comment.