Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(web): websocket reconnect #7234

Merged
merged 3 commits into from
Feb 20, 2024
Merged

Conversation

michelheusschen
Copy link
Contributor

The websocket connection doesn't properly re-establish after logging out and logging back in again. Fixed by using the $user store to detect whether the user is logged in.

Copy link

cloudflare-workers-and-pages bot commented Feb 20, 2024

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 562df15
Status: ✅  Deploy successful!
Preview URL: https://809f9079.immich.pages.dev
Branch Preview URL: https://fix-web-websocket-reconnect.immich.pages.dev

View logs

Copy link
Contributor

@jrasm91 jrasm91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make more sense to set the store to null instead?

@michelheusschen
Copy link
Contributor Author

Would it make more sense to set the store to null instead?

At first I didn't do that, because modifying the user store type requires lots of changes and would also cause errors because navigation hadn't completed yet. However, a workaround is possible by forcibly resetting the store to undefined and waiting until navigation has finished. Not the most elegant solution, but I've gone ahead and pushed the change.

Copy link
Contributor

@jrasm91 jrasm91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, that looks better to me at least.

@alextran1502 alextran1502 merged commit e7a875e into main Feb 20, 2024
25 checks passed
@alextran1502 alextran1502 deleted the fix/web-websocket-reconnect branch February 20, 2024 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants