Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3696298
D9683.id32897.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
D9683.id32897.diff
View Options
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,16 @@
// 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 +910,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'] },
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 8, 12:04 PM (2 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2817257
Default Alt Text
D9683.id32897.diff (2 KB)
Attached To
Mode
D9683: [native] stop persisting `messageStore.threads` via redux-persist
Attached
Detach File
Event Timeline
Log In to Comment