mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
fix(nuxt): use router.resolve
to resolve initial url (#4770)
This commit is contained in:
parent
686bd84d58
commit
f74a523f13
@ -185,7 +185,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
||||
nuxtApp.hooks.hookOnce('app:created', async () => {
|
||||
try {
|
||||
await router.replace({
|
||||
path: initialURL,
|
||||
...router.resolve(initialURL),
|
||||
force: true
|
||||
})
|
||||
} catch (error) {
|
||||
|
@ -59,6 +59,18 @@ describe('pages', () => {
|
||||
await expectNoClientErrors('/not-found')
|
||||
})
|
||||
|
||||
it('preserves query', async () => {
|
||||
const html = await $fetch('/?test=true')
|
||||
|
||||
// Snapshot
|
||||
// expect(html).toMatchInlineSnapshot()
|
||||
|
||||
// should render text
|
||||
expect(html).toContain('Path: /?test=true')
|
||||
|
||||
await expectNoClientErrors('/?test=true')
|
||||
})
|
||||
|
||||
it('/nested/[foo]/[bar].vue', async () => {
|
||||
const html = await $fetch('/nested/one/two')
|
||||
|
||||
|
1
test/fixtures/basic/pages/index.vue
vendored
1
test/fixtures/basic/pages/index.vue
vendored
@ -7,6 +7,7 @@
|
||||
<div>RuntimeConfig | testConfig: {{ config.testConfig }}</div>
|
||||
<div>Composable | foo: {{ foo }}</div>
|
||||
<div>Composable | bar: {{ bar }}</div>
|
||||
<div>Path: {{ $route.fullPath }}</div>
|
||||
<NuxtLink to="/">
|
||||
Link
|
||||
</NuxtLink>
|
||||
|
Loading…
Reference in New Issue
Block a user