fix case where cache is empty object

This commit is contained in:
Matt Hill
2021-07-21 20:39:17 -06:00
parent 5185db527a
commit 53ac2f5690

View File

@@ -67,12 +67,15 @@ export class Store<T extends { [key: string]: any }> {
private handleDump (dump: Dump<T>): void {
Object.keys(this.cache.data).forEach(key => {
if (dump.value[key] !== undefined) {
(this.cache.data as any)[key] = dump.value[key]
} else {
if (dump.value[key] === undefined) {
delete this.cache.data[key]
}
})
Object.entries(dump.value).forEach(([key, val]) => {
(this.cache.data as any)[key] = val
})
this.stash.deleteRange(this.cache.sequence, dump.id, false)
this.updateWatchedNodes('')
this.updateSequence(dump.id)