N
Nuxt15mo ago
Zeeeth

Dynamic route in nuxtRouteMiddleware

So i'm experimenting with dynamic routes and i try to create a Dynamic Route within a nuxtRouteMiddleware that matches the current path. The idea is that there will be some kind of API-request that verifies the existence of the route, and then it is created on the fly and then rendered. I have made a small stackblitz that demonstrates what i want to do and the router.addRoute works fine, but the page is actually not rendered. So... when i open the browser at /test-dynamic-route i want the pages/dynamicPage.vue to be rendered but i'm kind of stuck now. I hope someone have an idea of what to do, thanks! https://stackblitz.com/edit/github-1cetba?file=middleware/routeGuard.global.ts
1 Reply
Zeeeth
Zeeeth15mo ago
for anyone looking into this, i've created a bug-report related: https://github.com/nuxt/nuxt/issues/20491
GitHub
DynamicRoute from router.beforeEach in plugin: changed behaviour ·...
Environment Operating System: Darwin Node Version: v18.16.0 Nuxt Version: 3.4.1 Nitro Version: 2.3.3 Package Manager: npm@9.5.1 Builder: vite User Config: modules, runtimeConfig, sourcemap, devtool...