-
Notifications
You must be signed in to change notification settings - Fork 392
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: make @api decorator spec compliant #572
Conversation
Benchmark resultsBase commit: |
Benchmark resultsBase commit: |
I did not gave them the change, but I run all tests in all repos and in core, and manually verify all of it ;) |
// We need to add the proper bitmask for the sibling getter/setter if exists | ||
const siblingPair = getSiblingGetSetPair(property, propertyName, type); | ||
if (siblingPair) { | ||
acc[propertyName].config |= getPropertyBitmask(siblingPair.type); |
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.
What about completely removing the bitmask? We are not using it's capability, all the public properties should have a getter and a setter.
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.
What do you mean that we don't use it? We do use it in decorators/api.ts:
const config = (!isUndefined(meta) && hasOwnProperty.call(target, 'publicProps') && hasOwnProperty.call(meta, propName)) ? meta[propName].config : 0;
Eventually we will be able to remove it, but for now, we can't.
That’s the first thing I did, it broke everything left and right, because
we do have special logic depending if only a getter or setter is defined
in Interop. So we can’t remove the dissambiguation.
…On Mon, Aug 13, 2018 at 1:32 AM Pierre-Marie Dartus < ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In
packages/babel-plugin-transform-lwc-class/src/decorators/api/transform.js
<#572 (comment)>:
> @@ -32,6 +47,14 @@ function computePublicPropsConfig(decorators) {
}
acc[propertyName].config |= getPropertyBitmask(type);
+
+ // With the latest decorator spec a decorator only need to be in one of the getter/setter pair
+ // We need to add the proper bitmask for the sibling getter/setter if exists
+ const siblingPair = getSiblingGetSetPair(property, propertyName, type);
+ if (siblingPair) {
+ acc[propertyName].config |= getPropertyBitmask(siblingPair.type);
What about completely removing the bitmask? We are not using it's
capability, all the public properties should have a getter and a setter.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#572 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABH0qFM9z12-dklNRsuinJ1CAwCIj_Ktks5uQTmUgaJpZM4V5X9k>
.
|
Details
With the latests changes on the spec, a decorator on a getter/setter applies to both. This changes update the descriptor config to ensure that we push the right bitmask values.
In a nutshell:
If
@api
is declared in a getter/setter and its counterpart exist, its equivalent to have@api
in both the getter and the setterDoes this PR introduce a breaking change?