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: move input value getters and setters to InputMixin #5586

Merged
merged 8 commits into from
Feb 23, 2023

Conversation

vursen
Copy link
Contributor

@vursen vursen commented Feb 21, 2023

Description

The PR gathers input element value setters and getters from the components and moves them to InputMixin. Collecting them all in one single place will make it possible to fix updating _hasInputValue for all the components at once afterward.

Part of #5410

Type of change

  • Bugfix

@vursen vursen changed the title refactor: move input value getters to InputMixin refactor: move input value getters and setters to InputMixin Feb 21, 2023
@vursen vursen requested a review from ugur-vaadin February 21, 2023 12:16
@vursen vursen marked this pull request as ready for review February 21, 2023 12:16
@vursen vursen removed the request for review from ugur-vaadin February 21, 2023 12:17
@vursen vursen marked this pull request as draft February 21, 2023 12:17
@vursen vursen marked this pull request as ready for review February 21, 2023 15:18
@vursen vursen requested a review from ugur-vaadin February 21, 2023 15:20
@vursen vursen force-pushed the refactor/move-input-element-value-getter-to-input-mixin branch from 5ffdd62 to 80e421a Compare February 21, 2023 15:46
@vursen vursen force-pushed the refactor/move-input-element-value-getter-to-input-mixin branch from 80e421a to 1119d5d Compare February 21, 2023 16:07
@@ -538,8 +526,9 @@ export const DatePickerMixin = (subclass) =>
*/
checkValidity() {
const inputValid =
!this._inputValue ||
(!!this._selectedDate && this._inputValue === this._getFormattedDate(this.i18n.formatDate, this._selectedDate));
!this._inputElementValue ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider extracting the input value to a separate line e.g. like this:

const value = this._inputElementValue;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@vursen vursen requested a review from web-padawan February 22, 2023 11:06
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@@ -118,10 +118,15 @@ class ComboBoxLight extends ComboBoxDataProviderMixin(ComboBoxMixin(ValidateMixi
}

/**
* @return {string}
* Override this getter from `InputMixin` to allow using
Copy link
Contributor Author

@vursen vursen Feb 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Although I can see it is quite common in our code base, I would argue that it can be misleading to start a JSDoc description with Override... when intending to explain the reason we have overridden this or that method. Such a description can be interpreted as a command – as if it suggests you override the getter in case you would like to use a custom property name.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it can be misleading in some cases indeed.
Maybe it should be changed to Overriding instead.
Somehow I was using it consistently since Vaadin 22 🤷‍♂️

@@ -118,10 +118,15 @@ class ComboBoxLight extends ComboBoxDataProviderMixin(ComboBoxMixin(ValidateMixi
}

/**
* @return {string}
* Override this getter from `InputMixin` to allow using
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it can be misleading in some cases indeed.
Maybe it should be changed to Overriding instead.
Somehow I was using it consistently since Vaadin 22 🤷‍♂️

@vaadin-bot
Copy link
Collaborator

Hi @vursen , this commit cannot be picked to 24.0 by this bot, can you take a look and pick it manually?
Error Message: Error: Command failed: git cherry-pick 6f9b280
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:

git commit --allow-empty

Otherwise, please use 'git cherry-pick --skip'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants