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:
parent
d5906c2efe
commit
6080e6e827
1 changed files with 9 additions and 10 deletions
|
@ -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>
|
||||
|
||||
|
|
Loading…
Reference in a new issue