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

Add FormSubmitButton that listens on FormState #28701

Merged

Conversation

jhchong92
Copy link
Contributor

@jhchong92 jhchong92 commented Apr 14, 2024

closes #28256

Some forms allow submission on invalid and non-dirty state (e.g. Create Realm form). This behaviour provides more visible error messages if user clicks submit.

So, I decided to cater to this original behaviour by specifying it in Props.

export type FormSubmitButtonProps = ButtonProps & {
  ...
  allowNonDirty?: boolean
  allowInvalid?: boolean
};

@jhchong92 jhchong92 requested a review from a team as a code owner April 14, 2024 09:30
@jhchong92 jhchong92 force-pushed the 28256-prevent-duplicate-form-submission branch 2 times, most recently from 124164f to 28f91f6 Compare April 14, 2024 13:56
js/libs/ui-shared/src/main.ts Outdated Show resolved Hide resolved
@jhchong92 jhchong92 force-pushed the 28256-prevent-duplicate-form-submission branch from 28f91f6 to 85943f5 Compare April 14, 2024 17:02
@jhchong92 jhchong92 force-pushed the 28256-prevent-duplicate-form-submission branch from 85943f5 to 99b3fb0 Compare April 16, 2024 14:28
@jonkoops jonkoops force-pushed the 28256-prevent-duplicate-form-submission branch from 99b3fb0 to c604fe2 Compare April 16, 2024 14:48
@jhchong92 jhchong92 requested a review from jonkoops April 16, 2024 14:50
@jhchong92 jhchong92 force-pushed the 28256-prevent-duplicate-form-submission branch 3 times, most recently from aca3123 to 13322f9 Compare April 18, 2024 14:52
@ssilvert
Copy link
Contributor

@jhchong92 Can you fix conflicts, please? We would like to get this merged if you and @jonkoops can finish up.

@jhchong92 jhchong92 force-pushed the 28256-prevent-duplicate-form-submission branch from 13322f9 to ef00cd2 Compare May 1, 2024 15:32
@ssilvert
Copy link
Contributor

ssilvert commented May 6, 2024

@jhchong92 Please fix conflicts.
@jonkoops FYI

@jonkoops
Copy link
Contributor

jonkoops commented May 7, 2024

I'll take another look after the PR is rebased :)

@jhchong92 jhchong92 force-pushed the 28256-prevent-duplicate-form-submission branch from ef00cd2 to 0ff9b29 Compare May 7, 2024 15:20
@jhchong92
Copy link
Contributor Author

@jonkoops rebased completed :)

@edewit
Copy link
Contributor

edewit commented May 8, 2024

@jhchong92 seems there are conflicts again

Copy link
Contributor

@jonkoops jonkoops left a comment

Choose a reason for hiding this comment

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

Let's implement the second proposal, where isDisabled can be passed as an override if needed.

@jhchong92 jhchong92 force-pushed the 28256-prevent-duplicate-form-submission branch from 0ff9b29 to 70c218a Compare May 9, 2024 15:43
@jhchong92
Copy link
Contributor Author

I've applied the changes @jonkoops

closes keycloak#28256

Signed-off-by: jchong <jhchong92@gmail.com>
@jhchong92 jhchong92 force-pushed the 28256-prevent-duplicate-form-submission branch from 70c218a to 7bfab21 Compare May 9, 2024 16:39
@jonkoops
Copy link
Contributor

Wonderful, thanks a bunch for taking this on @jhchong92, we really appreciate it!

@jonkoops jonkoops merged commit 5cacf86 into keycloak:main May 14, 2024
53 checks passed
@jhchong92
Copy link
Contributor Author

Thank you @jonkoops ! I learned a lot from this, hope to contribute again in the future.

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

Successfully merging this pull request may close these issues.

Prevent duplicate form submission in Create realm dialog in admin ui
4 participants