It appears that goto
in SvelteKit does not do anything when it is instructed to redirect to the current webpage:
<script>
import { goto, invalidate } from '$app/navigation';
function reloadPage() {
const thisPage = window.location.pathname;
console.log('goto ' + thisPage);
goto(thisPage);
}
</script>
<button on:click={() => reloadPage()}>
Reload
</button>
In addition, I've tried invalidate
, as well as invalidate
followed by a goto
, as well as goto
with adding fake query parameters, and none of them will cause the page to refresh.
The only way I can get it working is by calling location.reload()
, however this will bypass SvelteKit's client side routing and go back to the server, reloading the entire app over the network.