-
Notifications
You must be signed in to change notification settings - Fork 515
Open
Description
Inertia adapter(s) affected
- React
- Vue 3
- Svelte
- Not Applicable
JS package version
2.0.17
Backend stack (optional)
No response
Describe the problem
router.push
does not push a new history entry; instead, it replaces it if the provided url
is identical to the previous one (even if it includes a hash).
As i see from the code, this behavior is intentional.
inertia/packages/core/src/page.ts
Line 62 in 4dd1942
replace = replace || isSameUrlWithoutHash(hrefToUrl(page.url), location) |
I would like to know what this check is for, since the fact that push
actually replaces the history state is very misleading and this behavior is not documented.
Steps to reproduce
<script>
import { router } from '@inertiajs/svelte';
</script>
<button onclick={() => router.push({ url: '' })}>push (empty)</button>
<button onclick={() => router.push({ url: '#bogus' })}>push (hash)</button>
<button onclick={() => router.push({ url: '?bogus' })}>push (query)</button>
Mlekar
Metadata
Metadata
Assignees
Labels
No labels