bug: devserver spawns multiple instances of web worker

Aperta
#3,740 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
typescript
Ambito
tooling

Direzione di ricerca

Inizia con la riproduzione collegata e app-root.tsx, esegui npm start, quindi salva il file sorgente aperto per riprodurre il ricaricamento del dev-server. Traccia il comportamento del ricaricamento e i callback del ciclo di vita e conferma che ricaricamenti ripetuti lasciano un solo timer e un processo worker senza richiedere un aggiornamento del browser.

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

Descrizione

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()
Lingua principale
TypeScript
Stelle
13.2k
Fork
865
Merge medio
2g 16h
PR unite (30g)
29

Preparare l'ambiente

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

Tutte le issue di stenciljs/core

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.