-
Notifications
You must be signed in to change notification settings - Fork 795
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
dist-hydrate-script
output target doesn't respect hydratedFlag
config
#3606
Comments
@nick-vincent thanks for filing the issue, and for providing a reproduction! It's a big help for us when going through and triaging issues. I've taken a look at your repro and read through some of the relevant code and I believe that you're right that Can you explain what you mean by the following?
I'm just wondering where you changed it such that it affected the built output, and what specifically wasn't working with Thanks! |
Hi @alicewriteswrongs, thanks for your reply! Apologies I wasn't clearer about the last bit. What I mean is that you can configure the hydratedFlag: {
selector: 'attribute',
name: 'yo-dawg'
} And the built file addHydratedFlag = e => e.classList.add('yo-dawg') I'd be happy to submit a PR for this, but I had trouble tracking down where this logic lives in the compiler. |
Thanks for the issue! This issue is being closed due to inactivity. If this is still an issue with the latest version of Stencil, please create a new issue and ensure the template is fully filled out. Thank you for using Stencil! |
Sorry about that! Reopening |
@nick-vincent sorry to miss your earlier message! I'm going to label this so it can be prioritized. Thanks for reporting! |
Despite I'm giving an example of why this is critical :)
Applying attribute is then a pretty handy solution, I use it for a year now. But with the issue mentioned by @nick-vincent , that I'm facing as well, |
@alicewriteswrongs I'm experiencing the same behavior with |
Maybe let's go with another issue so we can track it separately in case there's a different root cause for the same behavior? I don't know that's the case, but it will help us to have a If they have the same root cause we'll just close both of them when we fix anyhow! |
Is there any update on this issue? I'm getting similar problem with
It's working as expected, but a bit worried about all potential impact of that trick. We also tried |
Sorry for the slow progress on this issue! I've just taken another look at it, and I've got a bit of a fix together -- I'm not sure it's the best way of addressing the issue, but I'd love to know if it does fix the problem for anyone who's experiencing this. You can install it like so: npm install @stencil/core@4.18.0-dev.1715200204.567f0d2 |
This changes how BUILD conditionals get set for the Hydrate script to ensure that configuration set by users using `hydratedFlag` is respected. fixes #3606 STENCIL-609
A fix for this was included in today's v4.18.2 release! |
Stencil version:
Current behavior:
When using the
dist-hydrate-script
output target for SSR:renderToString()
always adds the classhydrated
instead of respecting thehydratedFlag
attribute configuration:Expected behavior:
I would expect hydration via
renderToString()
to correctly respect thehydratedFlag
attribute configuration:GitHub Reproduction Link:
Here is my basic stencil repo: https://github.com/nick-vincent/gradient
I have the
hydratedFlag
set toattribute
here and my output target asdist-hydrate-script
here.When you run
npm run start
insideweb-components
, Storybook correctly respects thehydratedFlag
config.However, if you inspect the built files, in
/web-components/dist/hydrate/index.js
thehydrated
class is always added:Other Information
Edit: Upon further inspection, it appears that you can configure the
name
of thehydratedFlag
:And the built file
/web-components/dist/hydrate/index.js
does change the flag name, but it still uses a class instead of an attribute:The text was updated successfully, but these errors were encountered: