mirror of
https://github.com/ReVanced/revanced-website.git
synced 2026-01-11 13:46:17 +00:00
fix(Search): replace window.history.pushState with goto
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
<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 searchTerm: string | null;
|
||||
export let searchTermFiltered: string | undefined;
|
||||
import { fade } from 'svelte/transition';
|
||||
import { quintOut } from 'svelte/easing';
|
||||
|
||||
function clear() {
|
||||
searchTerm = '';
|
||||
searchTermFiltered = '';
|
||||
window.history.pushState(null, '', window.location.href.split('?')[0])
|
||||
goto($page.url.pathname)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { fly } from 'svelte/transition';
|
||||
import { quintOut } from 'svelte/easing';
|
||||
import { page } from '$app/stores';
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
import type { PageData } from './$types';
|
||||
import type { Patch } from '$lib/types';
|
||||
@@ -78,7 +79,7 @@
|
||||
.replace(/-/g, '')
|
||||
.toLowerCase();
|
||||
// Update search URL params
|
||||
window.history.pushState(null, '', `${window.location.href.split('?')[0]}${searchTerm ? '?s=' + searchTerm : ''}`)
|
||||
goto(`${$page.url.pathname}${searchTerm ? '?s=' + searchTerm : ''}`)
|
||||
}, 500);
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user