Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
An issue was reported privately that the following situation could occur:
The issue was that in connectWebSocket.ts, createObservable(), in case user is logged in, we're waiting with setting up the websocket until the user's sync call has completeted. Now if page was refreshed after login, but before sync call completed, the webSocket will wait there forever. We still want to wait there in case user is logged in so that we don't setup a websocket subscribing to public data only and then realize the realms have changed and reconnect socket.
So the solution I made was in dexie-cloud-client.ts, to treat this in-between-state as if user has been changed and thus trigger a sync with purpose "pull" (which means it should sync regardless if we have local changes or not).
2nd commit: we also rewrite the deprecated
.toPromise()
method on Rx observables and usefirstValueFrom()
instead. We could also removetake(1)
because firstValueFrom() will only take first emitted value anyway.