Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F2833295
D12164.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
D12164.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
@@ -1,7 +1,6 @@
// @flow
import invariant from 'invariant';
-import _filter from 'lodash/fp/filter.js';
import _flow from 'lodash/fp/flow.js';
import _groupBy from 'lodash/fp/groupBy.js';
import _isEqual from 'lodash/fp/isEqual.js';
@@ -109,15 +108,6 @@
)([...entryInfos]);
}
-function filterExistingDaysToEntriesWithNewEntryInfos(
- oldDaysToEntries: { +[id: string]: string[] },
- newEntryInfos: { +[id: string]: RawEntryInfo },
-) {
- return _mapValues((entryIDs: string[]) =>
- _filter((id: string) => newEntryInfos[id])(entryIDs),
- )(oldDaysToEntries);
-}
-
function mergeNewEntryInfosOps(
currentEntryInfos: { +[id: string]: RawEntryInfo },
currentDaysToEntries: ?{ +[day: string]: string[] },
@@ -524,21 +514,22 @@
};
}
// Make sure the entry is in sync with its latest revision
- const newEntryInfos = {
- ...entryInfos,
- [id]: {
- ...entryInfos[id],
- text: action.payload.text,
- deleted: action.payload.deleted,
+ const ops = [
+ {
+ type: 'replace_entry',
+ payload: {
+ id,
+ entry: {
+ ...entryInfos[id],
+ text: action.payload.text,
+ deleted: action.payload.deleted,
+ },
+ },
},
- };
+ ];
return {
- entryStore: {
- entryInfos: newEntryInfos,
- daysToEntries,
- lastUserInteractionCalendar,
- },
- entryStoreOperations: [],
+ entryStore: entryStoreOpsHandlers.processStoreOperations(entryStore, ops),
+ entryStoreOperations: ops,
reportCreationRequests: [],
};
} else if (action.type === restoreEntryActionTypes.success) {
@@ -646,17 +637,21 @@
reportCreationRequests: [],
};
}
- const newDaysToEntries = filterExistingDaysToEntriesWithNewEntryInfos(
- daysToEntries,
- newEntryInfos,
- );
- return {
- entryStore: {
- entryInfos: newEntryInfos,
- daysToEntries: newDaysToEntries,
- lastUserInteractionCalendar,
+ const ops = [
+ {
+ type: 'remove_all_entries',
},
- entryStoreOperations: [],
+ ...Object.entries(newEntryInfos).map(([id, entry]) => ({
+ type: 'replace_entry',
+ payload: {
+ id,
+ entry,
+ },
+ })),
+ ];
+ return {
+ entryStore: entryStoreOpsHandlers.processStoreOperations(entryStore, ops),
+ entryStoreOperations: ops,
reportCreationRequests: [],
};
} else if (action.type === processServerRequestsActionType) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Sep 29, 7:51 AM (22 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2199490
Default Alt Text
D12164.diff (2 KB)
Attached To
Mode
D12164: [lib] Migrate remaining actions
Attached
Detach File
Event Timeline
Log In to Comment