1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2024-12-28 06:31:58 +00: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>