mirror of
https://github.com/Start9Labs/patch-db.git
synced 2026-03-26 10:21:53 +00:00
fix case where cache is empty object
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user