Repeated navigation in an Inertia/Vue application causes the Vue Devtools Chrome extension (7.7.7) to become progressively slower.

Aperta
#1,193 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
58/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
devtools

Direzione di ricerca

Start by locating initDevToolsServerListener() and tracing how it registers handlers on devtools.ctx.hooks through the birpc interface. Check how the broadcast instance behaves during teardown and reconnection before deciding whether an initialization guard is safe. Done means repeated initialization no longer adds duplicate handlers or causes redundant messages, while reconnection behavior remains correct.

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

Descrizione

fix: prevent duplicate DevTools server listener registration

##created with help of AI

Problem

Repeated navigation in an Inertia/Vue application causes the Vue Devtools Chrome extension (7.7.7) to become progressively slower.

Investigation revealed that initDevToolsServerListener() can be invoked repeatedly through the birpc interface. Each invocation registers additional handlers on devtools.ctx.hooks, without checking whether those handlers have already been registered.

After several navigations, the internal hook registry contained 45 distinct handlers for each of the following events:

  • routerInfoUpdated
  • sendInspectorTreeToClient
  • sendInspectorStateToClient

This caused thousands of redundant inspector and router messages, despite relatively few Vue component lifecycle events.

Fix

Make initDevToolsServerListener() idempotent using a module-scoped initialization guard.

Subsequent RPC calls no longer register duplicate listeners.

Verification
  • Reproduced with Vue 3.5.42 and Inertia 2.1.6.
  • Reproduced using a minimal Vue application without Pinia or Vue Router.
  • Confirmed repeated initDevToolsServerListener() RPC invocations using Chrome's debugger.
  • Confirmed accumulation of 45 distinct callbacks per internal messaging hook.
  • Verified that deduplicating listeners and preventing further registration resolves the performance degradation.
Considerations

The guard assumes that the underlying RPC broadcast instance remains valid across subsequent initialization requests.

Connection teardown and reconnection behavior should be verified before merging.

Lingua principale
TypeScript
Stelle
2.9k
Fork
292
Merge medio
3g 22h
PR unite (30g)
29

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 vuejs/devtools

Tutte le issue di vuejs/devtools

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.