Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F2902753
D9915.id33379.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D9915.id33379.diff
View Options
diff --git a/lib/reducers/master-reducer.js b/lib/reducers/master-reducer.js
--- a/lib/reducers/master-reducer.js
+++ b/lib/reducers/master-reducer.js
@@ -36,7 +36,6 @@
} from '../types/socket-types.js';
import type { StoreOperations } from '../types/store-ops-types.js';
import { isDev } from '../utils/dev-utils.js';
-import { ashoatKeyserverID } from '../utils/validation-utils.js';
export default function baseReducer<N: BaseNavInfo, T: BaseAppState<N>>(
state: T,
@@ -82,39 +81,43 @@
let keyserverStore = reduceKeyserverStore(state.keyserverStore, action);
if (
- keyserverStore.keyserverInfos[ashoatKeyserverID].connection.status !==
- 'connected' &&
action.type !== incrementalStateSyncActionType &&
action.type !== fullStateSyncActionType &&
action.type !== registerActionTypes.success &&
action.type !== logInActionTypes.success &&
action.type !== siweAuthActionTypes.success
) {
- if (
- messageStore.currentAsOf[ashoatKeyserverID] !==
- state.messageStore.currentAsOf[ashoatKeyserverID]
- ) {
- messageStore = {
- ...messageStore,
- currentAsOf: {
- ...messageStore.currentAsOf,
- [ashoatKeyserverID]:
- state.messageStore.currentAsOf[ashoatKeyserverID],
- },
- };
- }
- if (
- keyserverStore.keyserverInfos[ashoatKeyserverID].updatesCurrentAsOf !==
- state.keyserverStore.keyserverInfos[ashoatKeyserverID].updatesCurrentAsOf
- ) {
- const keyserverInfos = { ...keyserverStore.keyserverInfos };
- keyserverInfos[ashoatKeyserverID] = {
- ...keyserverInfos[ashoatKeyserverID],
- updatesCurrentAsOf:
- state.keyserverStore.keyserverInfos[ashoatKeyserverID]
- .updatesCurrentAsOf,
- };
- keyserverStore = { ...keyserverStore, keyserverInfos };
+ for (const keyserverID in keyserverStore.keyserverInfos) {
+ if (
+ keyserverStore.keyserverInfos[keyserverID].connection.status ===
+ 'connected'
+ ) {
+ continue;
+ }
+ if (
+ messageStore.currentAsOf[keyserverID] !==
+ state.messageStore.currentAsOf[keyserverID]
+ ) {
+ messageStore = {
+ ...messageStore,
+ currentAsOf: {
+ ...messageStore.currentAsOf,
+ [keyserverID]: state.messageStore.currentAsOf[keyserverID],
+ },
+ };
+ }
+ if (
+ keyserverStore.keyserverInfos[keyserverID].updatesCurrentAsOf !==
+ state.keyserverStore.keyserverInfos[keyserverID].updatesCurrentAsOf
+ ) {
+ const keyserverInfos = { ...keyserverStore.keyserverInfos };
+ keyserverInfos[keyserverID] = {
+ ...keyserverInfos[keyserverID],
+ updatesCurrentAsOf:
+ state.keyserverStore.keyserverInfos[keyserverID].updatesCurrentAsOf,
+ };
+ keyserverStore = { ...keyserverStore, keyserverInfos };
+ }
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 6, 6:49 PM (21 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2250623
Default Alt Text
D9915.id33379.diff (2 KB)
Attached To
Mode
D9915: [lib] Refactor baseReducer
Attached
Detach File
Event Timeline
Log In to Comment