Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3390258
D12156.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
D12156.diff
View Options
diff --git a/lib/reducers/entry-reducer.js b/lib/reducers/entry-reducer.js
--- a/lib/reducers/entry-reducer.js
+++ b/lib/reducers/entry-reducer.js
@@ -42,6 +42,7 @@
} from '../actions/user-actions.js';
import { setNewSessionActionType } from '../keyserver-conn/keyserver-conn-types.js';
import type { EntryStoreOperation } from '../ops/entries-store-ops.js';
+import { entryStoreOpsHandlers } from '../ops/entries-store-ops.js';
import { entryID } from '../shared/entry-utils.js';
import { stateSyncSpecs } from '../shared/state-sync/state-sync-specs.js';
import { threadInFilterList } from '../shared/thread-utils.js';
@@ -215,26 +216,24 @@
if (Object.keys(newEntryInfos).length === Object.keys(entryInfos).length) {
return {
- entryStore: {
- entryInfos,
- daysToEntries,
- lastUserInteractionCalendar,
- },
+ entryStore,
entryStoreOperations: [],
reportCreationRequests: [],
};
}
- const newDaysToEntries = filterExistingDaysToEntriesWithNewEntryInfos(
- daysToEntries,
- newEntryInfos,
- );
+ const ops = [
+ { type: 'remove_all_entries' },
+ ...Object.entries(newEntryInfos).map(([id, entry]) => ({
+ type: 'replace_entry',
+ payload: {
+ id,
+ entry,
+ },
+ })),
+ ];
return {
- entryStore: {
- entryInfos: newEntryInfos,
- daysToEntries: newDaysToEntries,
- lastUserInteractionCalendar,
- },
- entryStoreOperations: [],
+ entryStore: entryStoreOpsHandlers.processStoreOperations(entryStore, ops),
+ entryStoreOperations: ops,
reportCreationRequests: [],
};
} else if (action.type === setNewSessionActionType) {
@@ -242,10 +241,6 @@
const newEntryInfos = _pickBy(
(entry: RawEntryInfo) => authorizedThreadInfos[entry.threadID],
)(entryInfos);
- const newDaysToEntries = filterExistingDaysToEntriesWithNewEntryInfos(
- daysToEntries,
- newEntryInfos,
- );
let newLastUserInteractionCalendar = lastUserInteractionCalendar;
if (
action.payload.sessionChange.cookieInvalidated &&
@@ -266,13 +261,22 @@
reportCreationRequests: [],
};
}
+ const ops = [
+ { type: 'remove_all_entries' },
+ ...Object.entries(newEntryInfos).map(([id, entry]) => ({
+ type: 'replace_entry',
+ payload: {
+ id,
+ entry,
+ },
+ })),
+ ];
return {
entryStore: {
- entryInfos: newEntryInfos,
- daysToEntries: newDaysToEntries,
+ ...entryStoreOpsHandlers.processStoreOperations(entryStore, ops),
lastUserInteractionCalendar: newLastUserInteractionCalendar,
},
- entryStoreOperations: [],
+ entryStoreOperations: ops,
reportCreationRequests: [],
};
} else if (action.type === fetchEntriesActionTypes.success) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 30, 11:01 PM (20 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2602695
Default Alt Text
D12156.diff (2 KB)
Attached To
Mode
D12156: [lib] Update delete keyserver, delete thread, leave thread and set new session actions with the ops approach
Attached
Detach File
Event Timeline
Log In to Comment