1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-25 10:43:13 +02:00

fix(web): infinite loop browser navigation crash admin settings page (#14850)

* fix(web): infinite loop browser navigation crash admin settings page

* pr feedback
This commit is contained in:
Alex 2024-12-21 13:26:01 -06:00 committed by GitHub
parent d5906c2efe
commit 6080e6e827
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,9 +9,9 @@
import { writable, type Writable } from 'svelte/store';
import { createContext } from '$lib/utils/context';
import { page } from '$app/state';
import { handlePromiseError } from '$lib/utils';
import { goto } from '$app/navigation';
import type { Snippet } from 'svelte';
import { handlePromiseError } from '$lib/utils';
const getParamValues = (param: string) => {
return new Set((page.url.searchParams.get(param) || '').split(' ').filter((x) => x !== ''));
@ -26,9 +26,9 @@
let { queryParam, state = writable(getParamValues(queryParam)), children }: Props = $props();
setAccordionState(state);
$effect(() => {
if (queryParam && $state) {
const searchParams = new URLSearchParams(page.url.searchParams);
$effect(() => {
if ($state.size > 0) {
searchParams.set(queryParam, [...$state].join(' '));
} else {
@ -36,7 +36,6 @@
}
handlePromiseError(goto(`?${searchParams.toString()}`, { replaceState: true, noScroll: true, keepFocus: true }));
}
});
</script>