fix: app submission edge cases (#4550) #833
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses bloom-housing#2173
Description
This PR protects two duplicate submission paths. The first being spam clicking the submission button which was caused by the button loadingMessage prop not sufficiently blocking the submission call which is captured here (bloom-housing/ui-seeds#98) and is now handled with a !submitting check at the top of the submit function. The second path was clicking back on the confirmation screen and clicking submit again. This is handled by redirecting the user if they already have a confirmation code since that is only saved on submitted applications.
Note that the ticket also includes reference to a "warning" but after talking to produce these two fixes are the desired behavior for handling this ticket.
How Can This Be Tested/Reviewed?
This can be tested on the public side by logging in, fill out an application, and attempt to spam click the submit button. Then, click the back button on the confirmation page and notice the toast and redirect. You should end up on the my applications page where you will only see one submission for your attempted spam click.
Then, repeat this process as a signed out user and you should be redirected to the listings page and only see one submission in the applications table (via db).
Author Checklist:
yarn generate:client
and/or created a migration when requiredReview Process: