fix(hydrate): support dash-case case in hydrate mode #6158
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is the current behavior?
Component properties can be read in the following 2 environments:
renderToString
function.render
method of a componentAccording 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?
Testing
Added an e2e test case for it.
Other information
n/a