After upgrading to RC.11, useRouter() cannot be used in composable
See original GitHub issueEnvironment
- Operating System:
Windows_NT
- Node Version:
v16.17.1
- Nuxt Version:
3.0.0-rc.11
- Nitro Version:
0.5.4
- Package Manager:
yarn@1.22.19
- Builder:
vite
- User Config:
ssr
,head
,css
,plugins
,components
,buildModules
,modules
,build
,vite
,serverHandlers
,devServerHandlers
,bridge
- Runtime Modules:
-
- Build Modules:
()
,@nuxt/bridge@3.0.0-27740081.058a6c1
Reproduction
Describe the bug
I used the command npx nuxi@latest upgrade --force
from https://github.com/nuxt/framework/discussions/7691 and when trying to use useRouter
I get the following error:
[vue-router]: Missing current instance. useRouter() must be called inside <script setup> or setup().
useRouetr
is used only after clicking on the button, when the instance is ready. Everything works fine in RC.8
Additional context
How can I safely roll back to RC.8?
Logs
No response
Issue Analytics
- State:
- Created a year ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Router in axum::routing - Rust - Docs.rs
use axum::{routing::get, Router}; let app = Router::new() .route("/", ... method will run after routing and thus cannot be used to rewrite the request...
Read more >Using Modules and Pinia to structure Nuxt 3 app
Modules are used to extend Nuxt core functionality. These modules can contain their own components, composables, pages, plugins, and even a ...
Read more >useRouter/withRouter receive undefined on query in first render
I found something: isReady: boolean - Whether the router fields are updated client-side and ready for use. Should only be used inside of ......
Read more >Router tutorial: tour of heroes - Angular
forRoot(); Set the router to compose HTML5 browser URLs ... When you use the Angular CLI to create a project that does use...
Read more >'useRouter' is not defined no-undef Code Example
isLoggedIn = function() {return false}) react redux . What is the use of the return function in the React Native Framework?
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Possible duplicate of #554?
Has it something to do with the vue-router 3.6 release adding useRoute() and useRouter() as composables for vue 2.7?