Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@GrahamS-Quartech
Copy link
Contributor

🎯 Summary

PIMS-1700

  • This adds a useDataSubmitter hook that is basically just a wrapper around useDataLoader with different verbs in the return object and automatic calling of the snackbar context to give feedback about submissions.
  • Modified all the places where submission api calls were triggered to use this new hook and modified their return types to yield the entire response object.
  • Replaced all submission s with the MUI lab component for use with the "submitting" property of the useDataSubmitter hook. This gives additional feedback to users while their request is in progress after submitting the form and before getting the snackbar popup. It also automatically disables the button during this time, preventing any doubled submission.

πŸ”° Checklist

  • I have read and agree with the following checklist and am following the guidelines in our Code of Conduct document.
  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation where required.
  • I have tested my changes to the best of my ability.
  • My changes generate no new warnings.

…y displays a formatted snackbar message depending on the response of the request.
…nd updated all the places they are called to handle them using useDataSubmitter instead of just calling them on their own
Copy link
Collaborator

@dbarkowsky dbarkowsky left a comment

Choose a reason for hiding this comment

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

Big fan of this change. Didn't notice any issues during manual testing.

<NavigateBackButton
navigateBackTitle={'Back to Disposal Projects'}
onBackClick={() => {}}
onBackClick={() => navigate('/projects')}
Copy link
Collaborator

Choose a reason for hiding this comment

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

How did this go unnoticed so long? πŸ˜†

return refreshData(...args)
.then((response) => {
if (!response?.ok) {
snackbar.setMessageState({
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like that these are handled here. Makes it very consistent.

@GrahamS-Quartech GrahamS-Quartech merged commit 7e1ffeb into main May 16, 2024
@GrahamS-Quartech GrahamS-Quartech deleted the PIMS-1700-SubmitHandler branch May 16, 2024 22:49
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.

3 participants