bug: devserver spawns multiple instances of web worker
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- tooling
Research direction
Start with the linked reproduction and app-root.tsx, run npm start, then save the opened source file to reproduce the dev-server reload. Trace the reload behavior and lifecycle callbacks, and confirm that repeated reloads leave only one timer and worker process without requiring a browser refresh.
Written by the indexing model from the issue text.
Description
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
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()
- Dominant language
- TypeScript
- Stars
- 13.1k
- Forks
- 855
- Avg merge
- 4h 7m
- Merged PRs (30d)
- 44
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from stenciljs/core
-
Stencil v5
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Stencil v5
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
Bug: Validated Stencil v5
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Feature: Want this? Upvote it!
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Feature: Want this? Upvote it!
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Similar issues
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
vercel/react-tweet#225 ·