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

bug/60719 disable wp comment submitter while the form request is in progress #17696

Conversation

akabiru
Copy link
Member

@akabiru akabiru commented Jan 23, 2025

Ticket

https://community.openproject.org/work_packages/60719

What are you trying to accomplish?

Prevent possible repeat submissions that can arise from slow network connections, and the user double clicking the comment submit button

Screenshots

*Clicking the submit button twice (quickly)

Before

double-send-slow-network.mp4

After

disable-submit-button.mp4

What approach did you choose and why?

Add submit button targets via StimulusJS to manually enable and disable the submit button onSubmit.

Turbo does automate this when using vanilla forms natively, but since we bypass the submit request to a turbo stream- it does not apply.

Merge checklist

  • Added/updated tests I'm not sure the tests are easy to automate here
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

@akabiru akabiru added the bugfix label Jan 23, 2025
@akabiru akabiru self-assigned this Jan 23, 2025
@akabiru akabiru force-pushed the bug/60719-duplicate-work-package-comments-when-clicking-submit-multiple-times branch 2 times, most recently from dad760a to edfe7ec Compare January 23, 2025 04:45
…rogress

https://community.openproject.org/work_packages/60719

Prevent possible repeate submissions that can arise from slow network connections,
and the user double clicking the comment submit button
@akabiru akabiru force-pushed the bug/60719-duplicate-work-package-comments-when-clicking-submit-multiple-times branch from edfe7ec to 221c664 Compare January 23, 2025 07:49
@akabiru akabiru marked this pull request as ready for review January 23, 2025 07:59
Copy link
Contributor

@brunopagno brunopagno 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 to me 👏

Nice video captures <3

});
}

private set formSubmitInProgress(inProgress:boolean) {
Copy link
Contributor

Choose a reason for hiding this comment

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

🟢 I think semantically it would make more sense to me if we used a regular function instead of a setter here. The reason being that it's not obvious that when we do the formSubmitInProgress = value that something else is happening. It looks like a flag.

No biggie though, feel free to ignore.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, makes sense to me! Updating...

@akabiru akabiru removed the request for review from oliverguenther January 24, 2025 06:31
@akabiru akabiru merged commit 68e7640 into dev Jan 24, 2025
12 checks passed
@akabiru akabiru deleted the bug/60719-duplicate-work-package-comments-when-clicking-submit-multiple-times branch January 24, 2025 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants