mirror of
https://github.com/Start9Labs/patch-db.git
synced 2026-03-30 12:01:57 +00:00
update comment
This commit is contained in:
@@ -65,11 +65,9 @@ export class PatchDB<T extends { [key: string]: any }> {
|
|||||||
start() {
|
start() {
|
||||||
if (this.sub) return
|
if (this.sub) return
|
||||||
|
|
||||||
// @claude fix #14: Previously used `source$.pipe(withLatestFrom(cache$))`.
|
// Simplified from `source$.pipe(withLatestFrom(cache$))`. Both are
|
||||||
// Because processUpdates mutates the cache object in place and re-emits it,
|
// equivalent since cache$ is a BehaviorSubject and processUpdates
|
||||||
// synchronous back-to-back emissions could sample an already-mutated
|
// mutates/re-emits synchronously, but `.value` is more direct.
|
||||||
// reference via withLatestFrom, skipping valid revisions due to the stale
|
|
||||||
// cache.id check. Reading `this.cache$.value` directly avoids the issue.
|
|
||||||
this.sub = this.source$.subscribe(updates => {
|
this.sub = this.source$.subscribe(updates => {
|
||||||
this.processUpdates(updates, this.cache$.value)
|
this.processUpdates(updates, this.cache$.value)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user