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

Prevent double click on form submission #173

Closed
wants to merge 1 commit into from

Conversation

FlavioF
Copy link
Contributor

@FlavioF FlavioF commented Nov 9, 2023

Blocking, double-click on form submission and add submitting form load screen

Copy link

vercel bot commented Nov 9, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
hosted-pages ✅ Ready (Inspect) Visit Preview Nov 9, 2023 0:16am

@FlavioF FlavioF self-assigned this Nov 9, 2023
@FlavioF FlavioF added bug Something isn't working echoes/intent: unblock Changes needed to solve a bug or unblock a customer labels Nov 9, 2023
Comment on lines +36 to +38
if (isSubmitting) {
return <LoadingPage title={t('activities.form.submitting')} />
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand why you added a loader here.

Wouldn't this cause "blinking" on the screen?

User clicks on form submit button
-> Page abruptly changes to loading
Activity completed, now waiting for next activity
-> Page abruptly changes to loading again
Form Activity loaded
Fetching form
-> Page abruptly changes to loading again
Form fetched

I would've expected a loader on the "Submit" button (disable button, show a spinner) than showing a loader on the full page. Wdyt?

Copy link
Contributor

@mohsinht mohsinht left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Added a minor suggestion, can be tackled later as well.

@rahulkeerthi rahulkeerthi self-requested a review November 9, 2023 15:01
Comment on lines +36 to +38
if (isSubmitting) {
return <LoadingPage title={t('activities.form.submitting')} />
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like this approach. Would prefer if we disabled the submit button on the form component itself while isSubmitting is true. I recognise this means you need to add a prop and handle this in the different form UI components but a layout-level loading page is overkill for a activity-level piece of state

@FlavioF FlavioF closed this Nov 9, 2023
@FlavioF FlavioF deleted the TP-385-track-was-activated-twice branch November 10, 2023 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working echoes/intent: unblock Changes needed to solve a bug or unblock a customer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants