Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 tasks done
MaksimShakavin opened this issue Jun 24, 2022 · 11 comments
Open
3 tasks done

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

MaksimShakavin opened this issue Jun 24, 2022 · 11 comments
Labels
Resolution: Refine This PR is marked for Jira refinement. We're not working on it - we're talking it through.

Comments

@MaksimShakavin
Copy link

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

@ionitron-bot ionitron-bot bot added the triage label Jun 24, 2022
@alicewriteswrongs
Copy link
Contributor

Hi @MaksimShakavin I am able to build and run your reproduction repo, thanks for providing that! Could you share some more specific information about what is currently happening in that repo that you're expecting not to be the case? I can see a simple test component rendering but I don't see any flickering or anything like that. Thanks!

@MaksimShakavin
Copy link
Author

Hi @alicewriteswrongs , thanks for looking into it. There is no flickering because component's styles are very simple. The key problem is that '.hydrated' class is not added to the component, if dist-custom-elements is used. Or is it expected and invisiblePrehydration only works for dist?

@alicewriteswrongs
Copy link
Contributor

@MaksimShakavin I believe this may be a duplicate of #3319, does that issue look like it describes your issue accurately to you? If so, I'll close this in favor of that one since it is already prioritized and in our work backlog.

@rwaskiewicz rwaskiewicz added Awaiting Reply This PR or Issue needs a reply from the original reporter. and removed needs reply labels Jun 28, 2022
@MaksimShakavin
Copy link
Author

Hi @alicewriteswrongs , it could be related but not exactly the same. In the bug above the problem is with hydration of pre-rendered html, not with invisiblePrehydration.

@ionitron-bot ionitron-bot bot removed the Awaiting Reply This PR or Issue needs a reply from the original reporter. label Jun 30, 2022
@MaksimShakavin
Copy link
Author

Hi @alicewriteswrongs , I've pushed and update to the reproduction repo to show you the flash Of unstyled content, that I am facing. It appears that I can reproduce it only in firefox and only if I have nested web-components. In my example button-component is used inside my-component. And only for dist-custom-elements.
flicker-bug

@MaksimShakavin
Copy link
Author

For more complex components, like one that we have in our project with tons of content the page loads in the following sequence:

  1. Blank page
  2. Unstyled content
  3. Blank page
  4. Components with an applied styles

@MaksimShakavin
Copy link
Author

On of our projects historically uses parcel, and dist doesn't work with it ,because of the issue described in #1882 . One of the solution is to use dist-custom-elements, but it doesn't work for us neither because of this bug.

@jcfranco
Copy link
Contributor

We encountered this as well. In case it helps, here's another repro case closer to our setup.

@alicewriteswrongs
Copy link
Contributor

@jcfranco thanks for the additional reproduction, I'll mark this for further discussion and prioritization.

@alicewriteswrongs alicewriteswrongs added the Resolution: Refine This PR is marked for Jira refinement. We're not working on it - we're talking it through. label Jul 15, 2022
@KevinCarnaille2
Copy link

Any update about the prioritization ? Facing the same issue and use pre-hydration style for most of my library.
I can only use dist atm :)

@MaksimShakavin
Copy link
Author

Hi @rwaskiewicz , is there any progress on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Refine This PR is marked for Jira refinement. We're not working on it - we're talking it through.
Projects
None yet
Development

No branches or pull requests

5 participants