Changeset View
Changeset View
Standalone View
Standalone View
web/redux/redux-setup.js
Show All 21 Lines | |||||
import baseReducer from 'lib/reducers/master-reducer.js'; | import baseReducer from 'lib/reducers/master-reducer.js'; | ||||
import { mostRecentlyReadThreadSelector } from 'lib/selectors/thread-selectors.js'; | import { mostRecentlyReadThreadSelector } from 'lib/selectors/thread-selectors.js'; | ||||
import { isLoggedIn } from 'lib/selectors/user-selectors.js'; | import { isLoggedIn } from 'lib/selectors/user-selectors.js'; | ||||
import { | import { | ||||
invalidSessionDowngrade, | invalidSessionDowngrade, | ||||
identityInvalidSessionDowngrade, | identityInvalidSessionDowngrade, | ||||
} from 'lib/shared/session-utils.js'; | } from 'lib/shared/session-utils.js'; | ||||
import type { CommunityStore } from 'lib/types/community-types.js'; | import type { CommunityStore } from 'lib/types/community-types.js'; | ||||
import type { DBOpsStore } from 'lib/types/db-ops-types.js'; | import type { MessageID, DBOpsStore } from 'lib/types/db-ops-types.js'; | ||||
import type { DraftStore } from 'lib/types/draft-types.js'; | import type { DraftStore } from 'lib/types/draft-types.js'; | ||||
import type { EnabledApps } from 'lib/types/enabled-apps.js'; | import type { EnabledApps } from 'lib/types/enabled-apps.js'; | ||||
import type { EntryStore } from 'lib/types/entry-types.js'; | import type { EntryStore } from 'lib/types/entry-types.js'; | ||||
import { type CalendarFilter } from 'lib/types/filter-types.js'; | import { type CalendarFilter } from 'lib/types/filter-types.js'; | ||||
import type { IntegrityStore } from 'lib/types/integrity-types.js'; | import type { IntegrityStore } from 'lib/types/integrity-types.js'; | ||||
import type { KeyserverStore } from 'lib/types/keyserver-types.js'; | import type { KeyserverStore } from 'lib/types/keyserver-types.js'; | ||||
import type { LifecycleState } from 'lib/types/lifecycle-state-types.js'; | import type { LifecycleState } from 'lib/types/lifecycle-state-types.js'; | ||||
import type { InviteLinksStore } from 'lib/types/link-types.js'; | import type { InviteLinksStore } from 'lib/types/link-types.js'; | ||||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | export type AppState = { | ||||
+initialStateLoaded: boolean, | +initialStateLoaded: boolean, | ||||
+integrityStore: IntegrityStore, | +integrityStore: IntegrityStore, | ||||
+globalThemeInfo: GlobalThemeInfo, | +globalThemeInfo: GlobalThemeInfo, | ||||
+customServer: ?string, | +customServer: ?string, | ||||
+communityStore: CommunityStore, | +communityStore: CommunityStore, | ||||
+dbOpsStore: DBOpsStore, | +dbOpsStore: DBOpsStore, | ||||
}; | }; | ||||
export type Action = | export type Action = $ReadOnly< | ||||
| BaseAction | | BaseAction | ||||
| { | |||||
+messageID?: MessageID, | |||||
... | |||||
| { +type: 'UPDATE_NAV_INFO', +payload: Partial<WebNavInfo> } | | { +type: 'UPDATE_NAV_INFO', +payload: Partial<WebNavInfo> } | ||||
| { | | { | ||||
+type: 'UPDATE_WINDOW_DIMENSIONS', | +type: 'UPDATE_WINDOW_DIMENSIONS', | ||||
+payload: WindowDimensions, | +payload: WindowDimensions, | ||||
} | } | ||||
| { | | { | ||||
+type: 'UPDATE_WINDOW_ACTIVE', | +type: 'UPDATE_WINDOW_ACTIVE', | ||||
+payload: boolean, | +payload: boolean, | ||||
} | } | ||||
| { +type: 'SET_INITIAL_REDUX_STATE', +payload: InitialReduxState }; | | { +type: 'SET_INITIAL_REDUX_STATE', +payload: InitialReduxState }, | ||||
}, | |||||
>; | |||||
function reducer(oldState: AppState | void, action: Action): AppState { | function reducer(oldState: AppState | void, action: Action): AppState { | ||||
invariant(oldState, 'should be set'); | invariant(oldState, 'should be set'); | ||||
let state = oldState; | let state = oldState; | ||||
let storeOperations: StoreOperations = { | let storeOperations: StoreOperations = { | ||||
draftStoreOperations: [], | draftStoreOperations: [], | ||||
threadStoreOperations: [], | threadStoreOperations: [], | ||||
messageStoreOperations: [], | messageStoreOperations: [], | ||||
▲ Show 20 Lines • Show All 344 Lines • Show Last 20 Lines |