mirror of
https://github.com/Start9Labs/patch-db.git
synced 2026-03-26 02:11:54 +00:00
patch client reset
This commit is contained in:
committed by
Aiden McClelland
parent
78cc5316a3
commit
ab9305fc92
@@ -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()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user