From a72c1c54997d1043ab9e7bda12576c7a5a0f5b3f Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Mon, 23 Aug 2021 15:04:49 -0600 Subject: [PATCH] send message when websocket open and clear store cache on reset --- client/lib/patch-db.ts | 3 --- client/lib/source/ws-source.ts | 3 +-- client/lib/store.ts | 1 + 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/client/lib/patch-db.ts b/client/lib/patch-db.ts index 58a1a13..179a1a6 100644 --- a/client/lib/patch-db.ts +++ b/client/lib/patch-db.ts @@ -20,9 +20,6 @@ export class PatchDB { .pipe( tap(update => this.store.update(update)), concatMap(() => of(this.store.cache)), - finalize(() => { - this.store.reset() - }), ) } } diff --git a/client/lib/source/ws-source.ts b/client/lib/source/ws-source.ts index 0fc0fa0..4a9fe21 100644 --- a/client/lib/source/ws-source.ts +++ b/client/lib/source/ws-source.ts @@ -15,8 +15,7 @@ export class WebsocketSource implements Source { url: this.url, openObserver: { next: () => { - console.log('WebSocket connection open') - this.websocket$!.next('open message' as any) + this.websocket$!.next(document.cookie as any) }, }, } diff --git a/client/lib/store.ts b/client/lib/store.ts index 7908084..3b9ea68 100644 --- a/client/lib/store.ts +++ b/client/lib/store.ts @@ -50,6 +50,7 @@ export class Store { reset (): void { Object.values(this.watchedNodes).forEach(node => node.complete()) + this.watchedNodes = { } this.stash.clear() }