-
Notifications
You must be signed in to change notification settings - Fork 789
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
feat: prop get set new #6050
Merged
christian-bromann
merged 11 commits into
ionic-team:main
from
johnjenkins:feat-prop-get-set-new
Nov 26, 2024
Merged
feat: prop get set new #6050
christian-bromann
merged 11 commits into
ionic-team:main
from
johnjenkins:feat-prop-get-set-new
Nov 26, 2024
Conversation
This file contains 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
12 tasks
@johnjenkins great work 👏 do you think this feature needs to amendments to the Stencil docs? |
christian-bromann
approved these changes
Nov 26, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 great work 👏
github-merge-queue
bot
removed this pull request from the merge queue due to failed status checks
Nov 26, 2024
@johnjenkins you legend! 🎉 |
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.
Allowing the
@Prop
decorator to use get / set provides many quality of life improvements for developers and can improve the api of their components (see linked issues for many valid, uncontested use cases).Validation & Guards. Transforming data. Read-only properties. All things that may be achievable at the moment but can be extremely cumbersome to implement.
What is the current behavior?
@Prop()
decorated attributes cannot be used withget()
orset()
GitHub Issue Number: Fixes #1359
What is the new behavior?
Documentation
@Prop
decorator attributes: attribute and reflect work as expected.Prop setters work as expected in relation to
@Watch
decorated methods (the Watch method will only be called after the setter has actually changed the property value).get()
only properties will be marked as@readonly
in the JSDoc comment.Known limitations
When using the
dist
/ 'lazy' bundle, If an initial value is set (via an attribute for example) in-order to 'go through' the class'set()
method, Stencil can only do so after lazily fetching / loading the class component. This means one initial render / tick before being able to set the incoming, initial value.This limitation does not exist on the
dist-custom-elements
/ non-lazy bundleionic-team/stencil-site#1496
Does this introduce a breaking change?
Testing
Other information