patch client reset

This commit is contained in:
Drew Ansbacher
2021-10-11 15:49:14 -06:00
committed by Aiden McClelland
parent 78cc5316a3
commit ab9305fc92
2 changed files with 6 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
import { merge, Observable, of } from 'rxjs'
import { concatMap, tap } from 'rxjs/operators'
import { concatMap, finalize, tap } from 'rxjs/operators'
import { Source } from './source/source'
import { Store } from './store'
import { DBCache, Http } from './types'
@@ -20,6 +20,7 @@ export class PatchDB<T> {
.pipe(
tap(update => this.store.update(update)),
concatMap(() => of(this.store.cache)),
finalize(() => this.store.reset()),
)
}
}

View File

@@ -52,6 +52,10 @@ export class Store<T extends { [key: string]: any }> {
this.watchedNodes = { }
this.stash.clear()
this.sequence$.next(0)
this.cache = {
sequence: 0,
data: { } as any,
}
}
private handleRevision (revision: Revision): void {