bug: hydrated flag doesn't work for dist-custom-elements build

Open
#3,437 12 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript

Research direction

Start with the linked reproduction repository: run yarn install, yarn build, and npx http-server packages/parcel-app/dist. Compare the dist and dist-custom-elements outputs to trace why the .hydrated class is missing. Done means the class is applied for the custom-elements build and the reported loading flicker is resolved.

Written by the indexing model from the issue text.

Description

Resolution: Refine
Prerequisites
Stencil Version

2.11.0

Current Behavior

.hydrated class is not been added to component if I usedist-custom-elements bundle.
Because of this I can see component flickering without styles while loading.
And also I have some logic in componentDidLoad that rely on some dom elements width. It works from time to time depending on when styles are applied. With dist output everything works as expected.

Expected Behavior

.hydrated class is working for both lazy-loading from dist output target and general dist-custom-elements

Steps to Reproduce

Check out the reproduction repo.
Run
yarn install
yarn build
npx http-server packages/parcel-app/dist

Code Reproduction URL

https://github.com/MaksimShakavin/stencil-hydrated-bug

Additional Information

No response

Dominant language
TypeScript
Stars
13.1k
Forks
855
Avg merge
4h 7m
Merged PRs (30d)
44

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from stenciljs/core

All issues in stenciljs/core

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.