bug: devserver spawns multiple instances of web worker

Đang mở
#3,740 1 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 1 ngày

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

Đánh giá

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

Hướng nghiên cứu

Bắt đầu với bản tái hiện được liên kết và app-root.tsx, chạy npm start, sau đó lưu tệp nguồn đang mở để tái hiện việc reload dev-server. Theo dõi hành vi reload và các callback vòng đời, đồng thời xác nhận rằng việc reload lặp lại chỉ để lại một timer và một tiến trình worker mà không cần làm mới trình duyệt.

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

Mô tả

Bug: Validated
Prerequisites
Stencil Version

2.18.1

Current Behavior

(Context)
I am trying to implement a solution where I use a web worker to periodically get messages from a backend via a websocket port.
During the development I have encountered two behaviours which seem a bit strange.

The linked repo contains a simplified version of this which reproduces the error(s)

  • If the dev server reloads it spawns a new timer (visible with the example below which will show multiple prefixes in the UI)
  • If the dev server reloads it spawns a new dedicated worker process but does not terminate the old one (visible in Google Chrome > Tools > Task Manager)
Expected Behavior
  • I would have expected that the dev server reload terminates or reuses the old worker process
  • I would have expected no additional timers (Repo contains deactivated code in app-root.tsx to cope with this)
Steps to Reproduce
  • npm start
  • open part of source (e.g. app-root.tsx) in any editor (e.g. VS Code)
  • save an opened file to trigger a devserver reload
Code Reproduction URL

https://github.com/mulztob/stencil-bug-worker-duplication.git

Additional Information
  • Both problems can be fixed by using the Browser Reload(F5)
  • On dev server reload it looks like every lifecycle hook is called except for disconnectedCallback()
Ngôn ngữ chính
TypeScript
Star
13.2k
Fork
865
Merge trung bình
2 ngày 16 giờ
Pull request đã merge (30 ngày)
29

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

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 stenciljs/core

Tất cả issue của stenciljs/core

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.