implemented applying of a patch

This commit is contained in:
lotte
2018-09-19 13:10:23 +02:00
parent 17ad62c172
commit e959542e2d
20 changed files with 226 additions and 147 deletions

View File

@@ -112,13 +112,15 @@ export function objectCacheReducer(state = initialState, action: ObjectCacheActi
* the new state, with the object added, or overwritten.
*/
function addToObjectCache(state: ObjectCacheState, action: AddToObjectCacheAction): ObjectCacheState {
const existing = state[action.payload.objectToCache.self];
return Object.assign({}, state, {
[action.payload.objectToCache.self]: {
data: action.payload.objectToCache,
timeAdded: action.payload.timeAdded,
msToLive: action.payload.msToLive,
requestHref: action.payload.requestHref,
isDirty: false
isDirty: false,
patches: (hasValue(existing) ? existing.patches : [])
}
});
}