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

Grafana/ui: Expose trigger method from useForm to children #73831

Merged
merged 1 commit into from
Aug 31, 2023

Conversation

javiruiz01
Copy link
Collaborator

@javiruiz01 javiruiz01 commented Aug 25, 2023

What is this feature?

This PR exposes the trigger method from useForm to the children components of Form.

Why do we need this feature?

(Link to docs) It allows to manually trigger form validation. A workaround can be made when trigger not available, but there is no real reason not to expose this method to the children components.
Almost all the other methods from useForm are returned, so it makes sense to also return this one.

For example, when building a Stepper component, you might need to trigger validation of the whole form on the last step to ensure there are no errors.

Who is this feature for?

Users of the Form component from @grafana/ui.

Which issue(s) does this PR fix?

Fixes issue #94.

@javiruiz01 javiruiz01 requested review from a team as code owners August 25, 2023 13:03
@javiruiz01 javiruiz01 requested review from joshhunt, L-M-K-B and mckn and removed request for a team August 25, 2023 13:03
@CLAassistant
Copy link

CLAassistant commented Aug 25, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@Clarity-89 Clarity-89 left a comment

Choose a reason for hiding this comment

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

Looks good! 🎉

Copy link
Contributor

@mckn mckn left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@L-M-K-B L-M-K-B left a comment

Choose a reason for hiding this comment

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

Is this change related to some issue or do you need it for some other task that may be worth mentioning in the PR description?

@javiruiz01
Copy link
Collaborator Author

I added the issue where this change will be used 👍

@L-M-K-B L-M-K-B self-requested a review August 31, 2023 09:07
Copy link
Contributor

@L-M-K-B L-M-K-B left a comment

Choose a reason for hiding this comment

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

Thanks for adding more details. Now it looks like you are good to go.😃

@L-M-K-B L-M-K-B merged commit 6dea273 into main Aug 31, 2023
35 checks passed
@L-M-K-B L-M-K-B deleted the javier/expose_trigger_method_form_component branch August 31, 2023 09:22
chauchausoup pushed a commit to chauchausoup/grafana that referenced this pull request Sep 15, 2023
…#73831)

Form: Expose trigger method from useForm to children
rwwiv pushed a commit that referenced this pull request Oct 2, 2023
Form: Expose trigger method from useForm to children
@zerok zerok modified the milestones: 10.2.x, 10.2.0 Oct 23, 2023
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.

None yet

6 participants