mirror of
https://github.com/Start9Labs/patch-db.git
synced 2026-03-30 03:51:56 +00:00
fix case where cache is empty object
This commit is contained in:
committed by
Aiden McClelland
parent
3e2e1c92dd
commit
ca8da5da6b
@@ -67,12 +67,15 @@ export class Store<T extends { [key: string]: any }> {
|
|||||||
|
|
||||||
private handleDump (dump: Dump<T>): void {
|
private handleDump (dump: Dump<T>): void {
|
||||||
Object.keys(this.cache.data).forEach(key => {
|
Object.keys(this.cache.data).forEach(key => {
|
||||||
if (dump.value[key] !== undefined) {
|
if (dump.value[key] === undefined) {
|
||||||
(this.cache.data as any)[key] = dump.value[key]
|
|
||||||
} else {
|
|
||||||
delete this.cache.data[key]
|
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.stash.deleteRange(this.cache.sequence, dump.id, false)
|
||||||
this.updateWatchedNodes('')
|
this.updateWatchedNodes('')
|
||||||
this.updateSequence(dump.id)
|
this.updateSequence(dump.id)
|
||||||
|
|||||||
Reference in New Issue
Block a user