-
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
Only add HYDRATED_CSS when cmpTags are set #3771
Conversation
|
Path | Error Count |
---|---|
src/dev-server/index.ts | 37 |
src/mock-doc/serialize-node.ts | 36 |
src/dev-server/server-process.ts | 32 |
src/compiler/build/build-stats.ts | 27 |
src/compiler/output-targets/dist-lazy/generate-lazy-module.ts | 25 |
src/compiler/style/test/optimize-css.spec.ts | 23 |
src/testing/puppeteer/puppeteer-element.ts | 23 |
src/compiler/prerender/prerender-main.ts | 22 |
src/runtime/client-hydrate.ts | 19 |
src/screenshot/connector-base.ts | 19 |
src/runtime/vdom/vdom-render.ts | 18 |
src/compiler/config/test/validate-paths.spec.ts | 16 |
src/dev-server/request-handler.ts | 15 |
src/compiler/prerender/prerender-optimize.ts | 14 |
src/compiler/sys/stencil-sys.ts | 14 |
src/compiler/transpile/transpile-module.ts | 14 |
src/runtime/vdom/vdom-annotations.ts | 14 |
src/sys/node/node-sys.ts | 14 |
src/compiler/build/build-finish.ts | 13 |
src/compiler/prerender/prerender-queue.ts | 13 |
Our most common errors
Typescript Error Code | Count |
---|---|
TS2345 | 418 |
TS2322 | 395 |
TS18048 | 310 |
TS18047 | 101 |
TS2722 | 38 |
TS2532 | 34 |
TS2531 | 23 |
TS2454 | 14 |
TS2352 | 13 |
TS2769 | 10 |
TS2790 | 10 |
TS2538 | 8 |
TS2344 | 5 |
TS2416 | 4 |
TS2493 | 3 |
TS18046 | 2 |
TS2684 | 1 |
TS2488 | 1 |
TS2430 | 1 |
Unused exports report
There are 15 unused exports on this PR. That's the same number of errors on main, so at least we're not creating new ones!
Unused exports
File | Line | Identifier |
---|---|---|
src/runtime/bootstrap-lazy.ts | 21 | setNonce |
src/screenshot/screenshot-fs.ts | 18 | readScreenshotData |
src/testing/testing-utils.ts | 198 | withSilentWarn |
src/utils/index.ts | 145 | CUSTOM |
src/utils/index.ts | 232 | resolve |
src/utils/index.ts | 246 | normalize |
src/utils/index.ts | 7 | escapeRegExpSpecialCharacters |
src/compiler/app-core/app-data.ts | 25 | BUILD |
src/compiler/app-core/app-data.ts | 115 | Env |
src/compiler/app-core/app-data.ts | 117 | NAMESPACE |
src/compiler/fs-watch/fs-watch-rebuild.ts | 123 | updateCacheFromRebuild |
src/compiler/types/validate-primary-package-output-target.ts | 62 | satisfies |
src/compiler/types/validate-primary-package-output-target.ts | 62 | Record |
src/testing/puppeteer/puppeteer-declarations.ts | 485 | WaitForEventOptions |
src/compiler/sys/fetch/write-fetch-success.ts | 7 | writeFetchSuccessSync |
Hey @raldenhoven 👋 Before we move forward with this PR, we'd like a little more information to better contextualize the need for this change. From the GH PR summary:
Thanks! |
Hey @rwaskiewicz I can understand.. I added a test that shows the broken css that is being injected by the bootstrap-lazy method. The easiest way to reproduce this bug was to call defineCustomElements multiple times on a page, hope this helps! |
Hey @raldenhoven 👋 I have a little more context now, thanks for the test! Can you please create a minimal reproduction case for us to look at? While the test helps, it's important for use to have as much context as possible in a minimal reproduction case that includes a Stencil config, similar usage to the real world problem, etc.; |
@rwaskiewicz The reproduction case: |
Thanks @raldenhoven! I'm going to label this for someone to take a closer look |
95d89b6
to
a57b905
Compare
When cmpTags are empty the added css is invalid.
e26e704
to
df9d35f
Compare
@raldenhoven I know this has been sitting for a while, but we've finally had a chance to look at it! As you noted, the issue is that That being said, I do think we could integrate this PR into the codebase as a safety mechanism if developers do end up in this situation. If you want to address the merge conflicts and make sure CI passes, I'd be happy to officially review this and bring it back to the team. Alternatively, I'm happy to finalize this work if you are not willing/able (or if we don't hear back from ya in a while 😉 ). |
@tanner-reits I'll make some time next week to update this MR! Thanks. |
This commit fixes an issue where invalid CSS could be generated and inserted into the DOM if `bootstrapLazy` was called with no component metadata or if no new components are registered in the custom element registry (i.e. it is called multiple times with the same metadata). STENCIL-632 Closes: #3771 Co-authored-by: Robin Aldenhoven <[email protected]>
@raldenhoven Just wanted to let ya know I created #5305 to resolve this and added you as a co-author on the main commit! Gonna close this PR out, but we should have the new PR reviewed and merged soon. Hope this helps! |
This commit fixes an issue where invalid CSS could be generated and inserted into the DOM if `bootstrapLazy` was called with no component metadata or if no new components are registered in the custom element registry (i.e. it is called multiple times with the same metadata). STENCIL-632 Closes: #3771 Co-authored-by: Robin Aldenhoven <[email protected]>
…ags (#5305) * fix(runtime): only generate lazy build CSS when there are component tags This commit fixes an issue where invalid CSS could be generated and inserted into the DOM if `bootstrapLazy` was called with no component metadata or if no new components are registered in the custom element registry (i.e. it is called multiple times with the same metadata). STENCIL-632 Closes: #3771 Co-authored-by: Robin Aldenhoven <[email protected]> * remove prehydration tests This commit removes some "invisible prehydration" tests that no longer work based on changes in 2559917. They no longer work because `bootstrapLazy` is called with the same compiler metadata so styles are not re-inserted after being manually removed by calls to `tearDownStylesScripts` in the respective test files * chore(karma): remove additional invisilbePrehydration infra * mark todo --------- Co-authored-by: Robin Aldenhoven <[email protected]> Co-authored-by: Ryan Waskiewicz <[email protected]>
The fix for this was just released today in Stencil v4.12.1! |
Pull request checklist
Please check if your PR fulfills the following requirements:
npm run build
) was run locally and any changes were pushednpm test
) were run locally and passednpm run test.karma.prod
) were run locally and passednpm run prettier
) was run locally and passedPull request type
Please check the type of change your PR introduces:
What is the current behavior?
An invalid piece of CSS is injected when cmpTags are empty. If this happens in JSDOM it will throw an invalid css error.
GitHub Issue Number: N/A
What is the new behavior?
The CSS will only be added to the head when cmpTags are defined (making the css always valid).
Does this introduce a breaking change?
Testing
Manually tested the change in the compiled code, no error where thrown again.
Other information