mirror of
https://github.com/immich-app/immich.git
synced 2025-12-17 09:13:17 +03:00
fix(web): websocket reconnect (#7234)
* fix(web): websocket reconnect * reset store after navigation completes * remove loggedOut check
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user