-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.2 Beta issue: router link effect is being run before the route component is unmounted #4148
Comments
Trying to boil it down without Vue Router by simulating the injected A much simpler repro is without nested routes, nor redirects: import { h } from '@vue/runtime-core'
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
const routes: RouteRecordRaw[] = [
{
name: 'a',
path: '/a/:id',
component: () => import('./ARoute.vue'),
},
{
name: 'b',
path: '/b',
component: { render: () => h('div', 'B content') },
},
]
export const router = createRouter({
history: createWebHistory(),
routes,
}) ARoute.vue <template>
<pre>{{ $route.params.id.toUpperCase() }}</pre>
</template> App.vue <template>
<nav class="flex pa4" style="gap: 30px">
<RouterLink :to="{ name: 'a', params: { id: 'test' } }">Go to A</RouterLink>
<RouterLink :to="{ name: 'b' }">Go to B</RouterLink>
</nav>
<RouterView />
</template>
|
Closing in favor of #4149 |
yyx990803
added a commit
that referenced
this issue
Jul 19, 2021
FYI, I upgraded to 3.2.0-beta-2 and while the repro is now working, our repo that initiated this issue is still failing. Will update soon |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Version
3.2.0-beta.1
Reproduction link
https://github.com/AlexandreBonaventure/vue3.2-bug
https://codesandbox.io/s/funny-monad-3sgle
Steps to reproduce
Click on 'Go to Route A' then on 'Go to Route B' and observe the error thrown in the console
What is expected?
It should not throw any error and switch route correctly (works with vue<3.2)
What is actually happening?
Error
The text was updated successfully, but these errors were encountered: