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!: replace _shouldSetInvalid with manualValidation property #6792

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vursen
Copy link
Contributor

@vursen vursen commented Nov 6, 2024

Description

Enables manual validation mode for web components instead of overriding the protected _shouldSetInvalid method. This is a breaking change, as it stops web components from dispatching the validated event.

Depends on

Type of change

  • Refactor

@vursen vursen changed the title refactor: use manual validation mode for web components refactor: use manualValidation property instead of _shouldSetInvalid Nov 6, 2024
Copy link

sonarqubecloud bot commented Nov 6, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
D Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

@vursen
Copy link
Contributor Author

vursen commented Nov 7, 2024

This refactor can break applications that listen for ClientValidatedEvent – it's no longer fired with enabled manual validation. We should probably deprecate this event first. HasClientValidation will also become obsolete.

@knoobie
Copy link
Contributor

knoobie commented Nov 7, 2024

Suggestion because ClientValidatedEvent is kinda recent and probably not much used (hopefully):

  • Add a "compatibility mode" as feature flag which uses the old code - which a user has to active.. so 24.6 uses the new method and people that need the old way can still return back by adding the flag (which would be removed in 25.?)

e.g.:

// Pseudo Code
if(attachEvent.getUI().getFeatureFlags(LEGACY_CLIENT_VALIDATION_EVENT_ENABLED, false)) 
  ClientValidationUtil.preventWebComponentFromModifyingInvalidState(this);
else 
  getElement().setProperty("manualValidation", true);

@vursen
Copy link
Contributor Author

vursen commented Nov 7, 2024

@knoobie Thanks for the suggestion. I'm afraid this refactoring isn't worth a feature flag since it's just an internal improvement to use public APIs instead of protected ones. I think we could just hold off this change until a later time.

@vursen vursen added the requires new major This would be a breaking change label Nov 7, 2024
@vursen vursen changed the title refactor: use manualValidation property instead of _shouldSetInvalid refactor!: use manualValidation property instead of _shouldSetInvalid Nov 7, 2024
@vursen vursen changed the title refactor!: use manualValidation property instead of _shouldSetInvalid refactor!: replace _shouldSetInvalid with manualValidation property Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
requires new major This would be a breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants