fix(web): websocket reconnect (#7234)

* fix(web): websocket reconnect

* reset store after navigation completes

* remove loggedOut check
This commit is contained in:
Michel Heusschen
2024-02-20 15:20:09 +01:00
committed by GitHub
parent 7f5459f050
commit e7a875eadd
3 changed files with 15 additions and 21 deletions

View File

@@ -22,10 +22,15 @@
let albumId: string | undefined;
const isSharedLinkRoute = (route: string | null) => route?.startsWith('/(user)/share/[key]');
const isAuthRoute = (route?: string) => route?.startsWith('/auth');
$: changeTheme($colorTheme);
$: if ($user) {
openWebsocketConnection();
} else {
closeWebsocketConnection();
}
const changeTheme = (theme: ThemeSetting) => {
if (theme.system) {
theme.value =
@@ -58,18 +63,7 @@
setKey($page.params.key);
}
beforeNavigate(({ from, to }) => {
const fromRoute = from?.route?.id || '';
const toRoute = to?.route?.id || '';
if (isAuthRoute(fromRoute) && !isAuthRoute(toRoute)) {
openWebsocketConnection();
}
if (!isAuthRoute(fromRoute) && isAuthRoute(toRoute)) {
closeWebsocketConnection();
}
beforeNavigate(() => {
showNavigationLoadingBar = true;
});
@@ -78,10 +72,6 @@
});
onMount(async () => {
if ($page.route.id?.startsWith('/auth') === false) {
openWebsocketConnection();
}
try {
await loadConfig();
} catch (error) {