diff --git a/src/Collections/CollectionChangeEntries.tsx b/src/Collections/CollectionChangeEntries.tsx index 7427f7d..d25c77e 100644 --- a/src/Collections/CollectionChangeEntries.tsx +++ b/src/Collections/CollectionChangeEntries.tsx @@ -31,7 +31,8 @@ export interface CachedItem { content: string; } -// FIXME: use the ones used by e.g. Contacts/Main so ew share the cache +// FIXME: use the ones used by e.g. Contacts/Main so ew share the cache. +// Only problem though is that we want the deleted items here and not there. async function decryptItems(items: Map>) { const entries: Map> = new Map(); for (const [colUid, col] of items.entries()) { diff --git a/src/Pim/helpers.tsx b/src/Pim/helpers.tsx index 2c128f3..47f432f 100644 --- a/src/Pim/helpers.tsx +++ b/src/Pim/helpers.tsx @@ -58,6 +58,9 @@ export function getDecryptItemsFunction(_colType: string, par const cur = new Map(); entries.set(colUid, cur); for (const item of col.values()) { + if (item.isDeleted) { + continue; + } try { const contact = parseFunc(await item.getContent(Etebase.OutputFormat.String)); contact.collectionUid = colUid; diff --git a/src/store/actions.ts b/src/store/actions.ts index aebd506..addc61b 100644 --- a/src/store/actions.ts +++ b/src/store/actions.ts @@ -93,20 +93,6 @@ export const setCacheItem = createAction( } ); -export const unsetCacheItem = createAction( - "UNSET_CACHE_ITEM", - (_colUid: string, _itemMgr: Etebase.ItemManager, itemUid: string) => { - return itemUid; - }, - (colUid: string, _itemMgr: Etebase.ItemManager, itemUid: string) => { - return { - colUid, - itemUid, - deleted: true, - }; - } -); - export const setCacheItemMulti = createAction( "SET_CACHE_ITEM_MULTI", async (_colUid: string, itemMgr: Etebase.ItemManager, items: Etebase.Item[]) => { diff --git a/src/store/reducers.ts b/src/store/reducers.ts index 2287e0c..a062e3a 100644 --- a/src/store/reducers.ts +++ b/src/store/reducers.ts @@ -120,15 +120,10 @@ export const collections = handleActions( export const items = handleActions( { [combineActions( - actions.setCacheItem, - actions.unsetCacheItem + actions.setCacheItem ).toString()]: (state: CacheItemsData, action: ActionMeta) => { if (action.payload !== undefined) { - if (action.meta.deleted) { - return state.removeIn([action.meta.colUid, action.meta.itemUid]); - } else { - return state.setIn([action.meta.colUid, action.meta.itemUid], action.payload); - } + return state.setIn([action.meta.colUid, action.meta.itemUid], action.payload); } return state; }, @@ -142,11 +137,7 @@ export const items = handleActions( return state.withMutations((state) => { let i = 0; for (const item of action.meta.items) { - if (item.isDeleted) { - state.removeIn([action.meta.colUid, item.uid]); - } else { - state.setIn([action.meta.colUid, item.uid], action.payload[i]); - } + state.setIn([action.meta.colUid, item.uid], action.payload[i]); i++; } });