-
Notifications
You must be signed in to change notification settings - Fork 405
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(babel-plugin-component): correct class member decorator validation #1122
Conversation
Benchmark resultsBase commit: lwc-engine-benchmark
|
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.
Except for the trailing console.log
, LGTM
@@ -145,6 +149,7 @@ module.exports = function validate(klass, decorators) { | |||
} | |||
}); | |||
|
|||
//console.log('---> decorators: ', decorators); |
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.
//console.log('---> decorators: ', decorators); |
const parentPath = path.parentPath; | ||
const name = parentPath.get('key.name').node; | ||
|
||
const associatedGetter = decorators.find( |
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.
Could you explain how this find
operation was picking up class methods that were not decorated with @api
?
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.
it was not. The filter logic resulted in a list of @api decorated setters and the find function was only looking at @api decorated getters. The issue was that we weren't cross referencing setter method name with the getter method name ( line 94 didn't check the current getter method name ).
Benchmark resultsBase commit: lwc-engine-benchmark
|
Details
Fixes #1113 - improve decorator validation logic.
Does this PR introduce a breaking change?