Skip to content

Commit

Permalink
Fix tmp error on logout: cannot read undefined (serverRevision)
Browse files Browse the repository at this point in the history
  • Loading branch information
dfahlander committed Mar 20, 2024
1 parent 3265585 commit 33fdadd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions addons/dexie-cloud/src/sync/connectWebSocket.ts
Expand Up @@ -99,7 +99,7 @@ export function connectWebSocket(db: DexieCloudDB) {
// Let server end query changes from last entry of same client-ID and forward.
// If no new entries, server won't bother the client. If new entries, server sends only those
// and the baseRev of the last from same client-ID.
if (userLogin) {
if (userLogin && db.cloud.persistedSyncState?.value) {
return new WSObservable(
db.cloud.options!.databaseUrl,
db.cloud.persistedSyncState!.value!.serverRevision,
Expand All @@ -110,8 +110,8 @@ export function connectWebSocket(db: DexieCloudDB) {
userLogin.accessToken,
userLogin.accessTokenExpiration
);
} else {
return from([] as WSConnectionMsg[]);
} else {
return from([] as WSConnectionMsg[]);
}}),
catchError((error) => {
if (error?.name === 'TokenExpiredError') {
Expand Down

0 comments on commit 33fdadd

Please sign in to comment.