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

fix(hydrate): support dash-case case in hydrate mode #6158

Merged
merged 7 commits into from
Feb 21, 2025

Conversation

christian-bromann
Copy link
Member

What is the current behavior?

Component properties can be read in the following 2 environments:

  • an HTML template, e.g. a Stencil runtime is loaded within an HTML page or you pass in a template to a renderToString function.
  • a JSX template, e.g. within the render method of a component

According to the property casing docs we expect camelcase in JSX and dash-case case in html templates. It appears however that Stencil supported dash-casing in JSX templates as well, though only at runtime (e.g. not in the hydrate module).

fixes #6150

What is the new behavior?

This patch adds support for dash-casing in JSX templates when running the hydrate script, to align with the runtime behavior. In general, dash-casing should only be used in HTML templates and not in JSX. However removing this capability may break peoples components as it is unclear how many folks are using dash casing.

Therefore I have added the dash-cased property as a type to the components.d.ts file and marked it as deprecated. I will create a v5 issue for it for us to re-evaluate whether we actually want to remove this or if it makes sense to keep it.

Documentation

Does this introduce a breaking change?

  • Yes
  • No

Testing

Added an e2e test case for it.

Other information

n/a

@christian-bromann christian-bromann merged commit 30f2a09 into main Feb 21, 2025
71 checks passed
@christian-bromann christian-bromann deleted the cb/jsx-prop-casing branch February 21, 2025 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: property casing in runtime vs SSR
1 participant