mirror of
https://github.com/revanced/revanced-website.git
synced 2025-05-29 04:40:14 +02:00
fix(Search): replace window.history.pushState
with goto
This commit is contained in:
parent
9734d9f64b
commit
77f0337445
@ -1,14 +1,17 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { fade } from 'svelte/transition';
|
||||||
|
import { quintOut } from 'svelte/easing';
|
||||||
|
import { page } from '$app/stores';
|
||||||
|
import { goto } from '$app/navigation';
|
||||||
|
|
||||||
export let title: string;
|
export let title: string;
|
||||||
export let searchTerm: string | null;
|
export let searchTerm: string | null;
|
||||||
export let searchTermFiltered: string | undefined;
|
export let searchTermFiltered: string | undefined;
|
||||||
import { fade } from 'svelte/transition';
|
|
||||||
import { quintOut } from 'svelte/easing';
|
|
||||||
|
|
||||||
function clear() {
|
function clear() {
|
||||||
searchTerm = '';
|
searchTerm = '';
|
||||||
searchTermFiltered = '';
|
searchTermFiltered = '';
|
||||||
window.history.pushState(null, '', window.location.href.split('?')[0])
|
goto($page.url.pathname)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
import { fly } from 'svelte/transition';
|
import { fly } from 'svelte/transition';
|
||||||
import { quintOut } from 'svelte/easing';
|
import { quintOut } from 'svelte/easing';
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
|
import { goto } from '$app/navigation';
|
||||||
|
|
||||||
import type { PageData } from './$types';
|
import type { PageData } from './$types';
|
||||||
import type { Patch } from '$lib/types';
|
import type { Patch } from '$lib/types';
|
||||||
@ -78,7 +79,7 @@
|
|||||||
.replace(/-/g, '')
|
.replace(/-/g, '')
|
||||||
.toLowerCase();
|
.toLowerCase();
|
||||||
// Update search URL params
|
// Update search URL params
|
||||||
window.history.pushState(null, '', `${window.location.href.split('?')[0]}${searchTerm ? '?s=' + searchTerm : ''}`)
|
goto(`${$page.url.pathname}${searchTerm ? '?s=' + searchTerm : ''}`)
|
||||||
}, 500);
|
}, 500);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user