Page MenuHomePhabricator

D9683.id32895.diff
No OneTemporary

D9683.id32895.diff

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
@@ -142,7 +142,6 @@
+messageStoreOperations: $ReadOnlyArray<MessageStoreOperation>,
+messageStore: MessageStore,
};
-
function freshMessageStore(
messageInfos: $ReadOnlyArray<RawMessageInfo>,
truncationStatus: { [threadID: string]: MessageTruncationStatus },
@@ -622,7 +621,6 @@
+messageStore: MessageStore,
+reassignedThreadIDs: string[],
};
-
function updateMessageStoreWithLatestThreadInfos(
messageStore: MessageStore,
threadInfos: { +[id: string]: RawThreadInfo },
@@ -710,7 +708,6 @@
+messageStoreOperations: $ReadOnlyArray<MessageStoreOperation>,
+messageStore: MessageStore,
};
-
function reduceMessageStore(
messageStore: MessageStore,
action: BaseAction,
@@ -1619,7 +1616,6 @@
+rawMessageInfos: $ReadOnlyArray<RawMessageInfo>,
+truncationStatuses: MessageTruncationStatuses,
};
-
function mergeUpdatesWithMessageInfos(
messageInfos: $ReadOnlyArray<RawMessageInfo>,
newUpdates: $ReadOnlyArray<ClientUpdateInfo>,
diff --git a/native/redux/persist.js b/native/redux/persist.js
--- a/native/redux/persist.js
+++ b/native/redux/persist.js
@@ -884,34 +884,18 @@
// this transformation should be executed in the `whitelist` property of the
// `config` object that's passed to `createTransform(...)`.
// eslint-disable-next-line no-unused-vars
-type PersistedThreadMessageInfo = {
- +startReached: boolean,
-};
+
type PersistedMessageStore = {
+local: { +[id: string]: LocalMessageInfo },
+currentAsOf: { +[keyserverID: string]: number },
- +threads: { +[threadID: string]: PersistedThreadMessageInfo },
};
const messageStoreMessagesBlocklistTransform: Transform = createTransform(
(state: MessageStore): PersistedMessageStore => {
const { messages, threads, ...messageStoreSansMessages } = state;
- // We also do not want to persist `messageStore.threads[ID].messageIDs`
- // because they can be deterministically computed based on messages we have
- // from SQLite
- const threadsToPersist = {};
- for (const threadID in threads) {
- const { messageIDs, ...threadsData } = threads[threadID];
- threadsToPersist[threadID] = threadsData;
- }
- return { ...messageStoreSansMessages, threads: threadsToPersist };
+ return { ...messageStoreSansMessages };
},
(state: MessageStore): MessageStore => {
- const { threads: persistedThreads, ...messageStore } = state;
- const threads = {};
- for (const threadID in persistedThreads) {
- threads[threadID] = { ...persistedThreads[threadID], messageIDs: [] };
- }
// We typically expect `messageStore.messages` to be `undefined` because
// messages are persisted in the SQLite `messages` table rather than via
// `redux-persist`. In this case we want to set `messageStore.messages`
@@ -928,7 +912,11 @@
// `messageStore` before migrations are run, we need to make sure we aren't
// inadvertently clearing `messageStore.messages` (by setting to {}) before
// messages are stored in SQLite (https://linear.app/comm/issue/ENG-2377).
- return { ...messageStore, threads, messages: messageStore.messages ?? {} };
+ return {
+ ...state,
+ threads: state.threads ?? {},
+ messages: state.messages ?? {},
+ };
},
{ whitelist: ['messageStore'] },
);
@@ -1015,9 +1003,11 @@
// import all the navigation and screen stuff, but some of those screens want to
// access the persistor to purge its state.
let storedPersistor = null;
+
function setPersistor(persistor: *) {
storedPersistor = persistor;
}
+
function getPersistor(): empty {
invariant(storedPersistor, 'should be set');
return storedPersistor;

File Metadata

Mime Type
text/plain
Expires
Wed, Jan 8, 11:26 AM (1 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2817039
Default Alt Text
D9683.id32895.diff (3 KB)

Event Timeline