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

feat: Add error handling for failed file uploads #3369

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

DafyddLlyr
Copy link
Contributor

@DafyddLlyr DafyddLlyr commented Jul 4, 2024

What does this PR do?

  • Follow up to fix: Don't allow undefined file URLs planx-core#434 - this PR now catches these errors client side and allows the user the opportunity to resolve them
  • Displays error if a file upload fails
  • Displays error if user tries to proceed with files with a status of "error"

Future improvements

  • It could be nice to add a "retry" button on failed uploads, but this will be covering a edge case. To our knowledge, a user submitting files which have failed to upload has only happened twice.

Comment on lines -191 to -194
isValid={
props.hideDropZone ||
slots.every((slot) => slot.url && slot.status === "success")
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ianjon3s Having a condition here on the isValid prop means that the "Continue" button is disabled, which goes against our general a11y principles.

Did we ever discuss this one, or is removing this here the right way to go?

Copy link
Member

Choose a reason for hiding this comment

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

Good catch, I think I missed this one when inventoring / fixing disabled "Continue" buttons here if you want to add to existing Trello checklist for collective memory! https://trello.com/c/elmTB1Pq/2828-disabled-buttons-and-unexpected-input-functionality-usability

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've actually removed it in this PR - added to checklist and marked as done!

Comment on lines +98 to +104
<ErrorWrapper
error={
status === "error"
? "Upload failed, please remove file and try again"
: undefined
}
>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding this wrapper is the change here, the diff below is purely a whitespace change due to the extra indentation but git hasn't quite caught this.

@DafyddLlyr DafyddLlyr marked this pull request as ready for review July 4, 2024 08:51
@DafyddLlyr DafyddLlyr requested a review from a team July 4, 2024 08:51
Copy link

github-actions bot commented Jul 4, 2024

Removed vultr server and associated DNS entries

Copy link
Member

@jessicamcinchak jessicamcinchak left a comment

Choose a reason for hiding this comment

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

Errors working as expected for me!

@DafyddLlyr DafyddLlyr merged commit 367327b into main Jul 8, 2024
12 checks passed
@DafyddLlyr DafyddLlyr deleted the dp/file-upload-failure-error-handling branch July 8, 2024 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants