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

refactor: proxy component #6084

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

johnjenkins
Copy link
Contributor

@johnjenkins johnjenkins commented Dec 20, 2024

Note - this is relying on #6076 to be merged first

What is the current behavior?

Following on from #6076 I delved into runtime decorators in combination with Stencil decorated members and found them to be quite limited.

One of the most useful things of property decorators is their ability to augment a class' prototype.

For example, If you want validation on an incoming value - e.g. an incoming number should be clamped between a floor and ceiling - you could use a decorator to add get() / set() accessors, checking and amending the incoming value.

Unfortunately, for @State and @Prop members, Stencil set's up it's own get() and set() and overrides any set on the prototype via decorators.

This gets in the way of expected / native behaviour.

GitHub Issue Number: N/A

What is the new behavior?

proxy-component.ts has been refactored:

  1. Merges the previously separate setter / getter handlers into a unified handler
  2. preserves and applies any already in-place accessors

Documentation

Does this introduce a breaking change?

  • Yes
  • No

Testing

I plan on adding some more run-time decorator tests

Other information

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.

1 participant