How to navigate under the same path removing the query string using a href?
#14885
Answered
by
frederikhors
frederikhors
asked this question in
Q&A
-
|
I have this code in a Svelte 5 / SvelteKit 2 app: <script lang="ts">
import { resolve } from '$app/paths';
// ...
</script>
{#each categories || [] as category (category.id)}
<a href={resolve(`/categories/${category.id}`)}>
{category.name}
</a>
{/each}If I add with another component a query string on the url like I'm already under Example:
|
Beta Was this translation helpful? Give feedback.
Answered by
frederikhors
Nov 5, 2025
Replies: 1 comment 3 replies
-
|
I'm honestly not sure if this case is expected behavior or just a bug, but you can opt out of the svelte navigation if you want by using <a href={resolve(`/categories/${category.id}`)} data-sveltekit-reload>But you may lose state passed down from layouts because of the page reload, so maybe this isn't all that useful in your case |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I opened #14890.