mirror of
https://github.com/Start9Labs/patch-db.git
synced 2026-03-26 10:21:53 +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 { merge, Observable, of } from 'rxjs'
|
||||||
import { concatMap, tap } from 'rxjs/operators'
|
import { concatMap, finalize, tap } from 'rxjs/operators'
|
||||||
import { Source } from './source/source'
|
import { Source } from './source/source'
|
||||||
import { Store } from './store'
|
import { Store } from './store'
|
||||||
import { DBCache, Http } from './types'
|
import { DBCache, Http } from './types'
|
||||||
@@ -20,6 +20,7 @@ export class PatchDB<T> {
|
|||||||
.pipe(
|
.pipe(
|
||||||
tap(update => this.store.update(update)),
|
tap(update => this.store.update(update)),
|
||||||
concatMap(() => of(this.store.cache)),
|
concatMap(() => of(this.store.cache)),
|
||||||
|
finalize(() => this.store.reset()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,10 @@ export class Store<T extends { [key: string]: any }> {
|
|||||||
this.watchedNodes = { }
|
this.watchedNodes = { }
|
||||||
this.stash.clear()
|
this.stash.clear()
|
||||||
this.sequence$.next(0)
|
this.sequence$.next(0)
|
||||||
|
this.cache = {
|
||||||
|
sequence: 0,
|
||||||
|
data: { } as any,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleRevision (revision: Revision): void {
|
private handleRevision (revision: Revision): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user