feat: new core decorators @PropSerialize & @AttrDeserialize#6387
Merged
johnjenkins merged 19 commits intomainfrom Oct 1, 2025
Merged
feat: new core decorators @PropSerialize & @AttrDeserialize#6387johnjenkins merged 19 commits intomainfrom
@PropSerialize & @AttrDeserialize#6387johnjenkins merged 19 commits intomainfrom
Conversation
Contributor
Author
|
What do people think about the names
Something else? |
added 2 commits
September 17, 2025 20:16
|
I lean toward keeping |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?
Following on from #6384 it surfaced a number of rough edges Stencil has around serializing properties to attributes and de-serializing attributes to properties.
Previously, Stencil has 'baked-in' certain serialization behaviours then use meta heuristics to decide when to use them.
e.g. 'When a property has an
unknowntype, it's incoming set value is a string, and that string starts with[or{let's JSONparse()'This behaviour is opaque and error-prone.
What is the new behavior?
Fixes #6247
Partially fixes #6216
Partially fixes #5110
2 new decorators have been added
@PropSerializeand@AttrDeserialize- both having a similar footprint as the@Watchdecorator.@PropSerializeallows devs to explicitly set property > attribute serializers - turning a complex value into a string.A good use case might be to use this only on the server during SSR - the serialized value being stringified in the resulting HTML can be ingested during client-side hydration.
@AttrDeserializeallows devs to explicitly set attribute > property translators. So setting a date attribute value of2025-09-16can now be immediately translated into aDateobject.Documentation
TODO - update docs site
Does this introduce a breaking change?
Testing
Other information