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

Đang mở
#1,193 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
58/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
devtools

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
2.9k
Fork
292
Merge trung bình
3 ngày 22 giờ
Pull request đã merge (30 ngày)
29

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của vuejs/devtools

Tất cả issue của vuejs/devtools

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.