Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Nuxt `navigateTo()` never produces a `navigates` edge: the Vue resolver claims it first

Aperta Adatta ai principianti
#2,634 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
90/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
nuxtjs, typescript

Direzione di ricerca

Inizia con src/resolution/frameworks/vue.ts e src/resolution/frameworks/vue-router.ts, quindi verifica la risoluzione tramite src/resolution/index.ts. Aggiungi o aggiorna un test di regressione per l’indicizzazione Nuxt accanto a __tests__/vue-router.test.ts per coprire navigateTo() in una pagina e nel middleware delle route. Fatto significa che entrambe le chiamate producono archi navigates senza modificare il comportamento esistente di router.push.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Version: codegraph 1.6.2 (bundled runtime, Linux x64), also reproduced on main at baf1906

Project: Nuxt 4 apps (srcDir: app/) in a pnpm monorepo, file-based routes under app/pages/

What happens

The README lists Nuxt's navigateTo among the navigation calls that become navigates edges, but no navigateTo call ever does. router.push in the same project is linked fine.

Minimal repro (3 files, package.json depends on nuxt and vue):

<!-- pages/index.vue -->
<script setup lang="ts">
await navigateTo('/target');
</script>
<template><div /></template>
<!-- pages/push.vue -->
<script setup lang="ts">
const router = useRouter();
function go() { router.push('/target'); }
</script>
<template><button @click="go" /></template>
<!-- pages/target.vue -->
<template><div /></template>

After codegraph init:

  • pages/push.vue → navigates → /target (resolver vue-router)
  • pages/index.vue → calls → index, i.e. the page itself (resolver vue), and no navigates edge

Route middleware is affected the same way: navigateTo('/login') in middleware/auth.global.ts produces no edge.

Cause
  1. src/resolution/frameworks/vue.ts:36: navigateTo is in NUXT_AUTO_IMPORTS.
  2. vue.ts:127 (Pattern 2) resolves any auto-import to the calling node (targetNodeId: ref.fromNodeId) with confidence 1.0.
  3. src/resolution/frameworks/index.ts:60-64: vueResolver is registered before vueRouterResolver.
  4. src/resolution/index.ts:1450: the first framework result with confidence >= 0.9 ends the loop, so the navigateTo handling in vue-router.ts:303 is never reached.

__tests__/vue-router.test.ts:94 only checks vueNavVerb('navigateTo'), not an indexed Nuxt project, which is why this went unnoticed.

Fix tested

Removing the 'navigateTo' line from NUXT_AUTO_IMPORTS in vue.ts:

before after
minimal repro 1 navigates edge (push) 2 (push + navigateTo)
two real Nuxt 4 apps (~60 pages) 55 navigates edges 94 (+39 navigateTo, middleware included)

vue-options-api, vuex-dispatch-synthesizer, vue-resolver-language, vue-store-extraction, vue-template-calls and vue-router test files still pass (41 tests). Reordering the resolvers would likely work too, but the one-line removal is the smallest change.

Expected

navigateTo('/x') produces a navigates edge to the /x route, like router.push('/x'), including from route middleware.

Related

#2473 (another Nuxt auto-import gap in .vue files, about project composables rather than navigateTo).

Lingua principale
C
Stelle
73.2k
Fork
4.7k
Merge medio
2h 16m
PR unite (30g)
423

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di colbymchenry/codegraph

Tutte le issue di colbymchenry/codegraph

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.