Page MenuHomePhabricator

D12409.diff
No OneTemporary

D12409.diff

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
@@ -83,12 +83,7 @@
// Only allow checkpoints to increase if we are connected
// or if the action is a STATE_SYNC
const { messageStoreOperations, messageStore: reducedMessageStore } =
- reduceMessageStore(
- state.messageStore,
- action,
- threadInfos,
- onStateDifferenceForStaff,
- );
+ reduceMessageStore(state.messageStore, action, threadInfos);
let messageStore = reducedMessageStore;
let { keyserverStore, keyserverStoreOperations } = reduceKeyserverStore(
diff --git a/lib/reducers/message-reducer.js b/lib/reducers/message-reducer.js
--- a/lib/reducers/message-reducer.js
+++ b/lib/reducers/message-reducer.js
@@ -111,9 +111,7 @@
type ClientUpdateInfo,
processUpdatesActionType,
} from '../types/update-types.js';
-import { getMessageForException } from '../utils/errors.js';
import { translateClientDBThreadMessageInfos } from '../utils/message-ops-utils.js';
-import { assertObjectsAreEqual } from '../utils/objects.js';
const _mapValuesWithKeys = _mapValues.convert({ cap: false });
@@ -146,31 +144,6 @@
);
}
-function assertMessageStoreLocalMessageInfosAreEqual(
- processedMessageStore: MessageStore,
- expectedMessageStore: MessageStore,
- location: string,
- onStateDifference?: (message: string) => mixed,
-) {
- try {
- assertObjectsAreEqual(
- processedMessageStore.local,
- expectedMessageStore.local,
- `MessageStore.local - ${location}`,
- );
- } catch (e) {
- console.log(
- 'Error processing MessageStore local ops',
- processedMessageStore.local,
- expectedMessageStore.local,
- );
- const message = `Error processing MessageStore local ops ${
- getMessageForException(e) ?? '{no exception message}'
- }`;
- onStateDifference?.(message);
- }
-}
-
const newThread = (): ThreadMessageInfo => ({
messageIDs: [],
startReached: false,
@@ -779,7 +752,6 @@
messageStore: MessageStore,
action: BaseAction,
newThreadInfos: RawThreadInfos,
- onStateDifference?: (message: string) => mixed,
): ReduceMessageStoreResult {
if (
action.type === legacyLogInActionTypes.success ||
@@ -1688,16 +1660,6 @@
const actionPayloadMessageStoreLocalMessageInfos =
action.payload.messageStoreLocalMessageInfos ?? {};
- assertMessageStoreLocalMessageInfosAreEqual(
- {
- ...messageStore,
- local: actionPayloadMessageStoreLocalMessageInfos,
- },
- messageStore,
- action.type,
- onStateDifference,
- );
-
const newThreads: {
[threadID: string]: ThreadMessageInfo,
} = { ...messageStore.threads };
@@ -1712,13 +1674,21 @@
if (!payloadMessages) {
return {
messageStoreOperations: [],
- messageStore: { ...messageStore, threads: newThreads },
+ messageStore: {
+ ...messageStore,
+ threads: newThreads,
+ local: actionPayloadMessageStoreLocalMessageInfos,
+ },
};
}
const { messageStoreOperations, messageStore: updatedMessageStore } =
updateMessageStoreWithLatestThreadInfos(
- { ...messageStore, threads: newThreads },
+ {
+ ...messageStore,
+ threads: newThreads,
+ local: actionPayloadMessageStoreLocalMessageInfos,
+ },
newThreadInfos,
);

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 20, 6:39 AM (20 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2675794
Default Alt Text
D12409.diff (3 KB)

Event Timeline