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.
Changes:
FileUploader
to a function component..destroy()
method when the component unmounts.This prevents the form HTML from getting added to the page multiple times when the modal is closed and re-opened.The duplicated HTML is no longer an issue after Fix: upload modal closes when clicking inside #2245. Still seems like a good idea to cleanup.accept
andsending
callbacks don't involve Redux at all so I think it's weird todispatch
them (though it does work just fine). I'm calling them as plain functions instead.if
condition into a utility functionisS3Upload
.localIntercept
function which usesFileReader
. We can use.text()
method on thefile
object which is the newer approach.accept
function syntax fromPromise.then
toasync
/await
.if
condition from the error branch with the magic of the optional chaining?.
attachments[]
field on the form. I can't see why we would need this and it works without it. The Dropzone already includes the binary data in the form under thefile
property. Pinging @catarak - maybe she knows why it's there. It's possible that it used to be necessary but isn't anymore.I have verified that this pull request:
npm run lint
)npm run test
)develop
branch.Fixes #123