Page MenuHomePhabricator

[Cashtab] fix antd error in console when user clicks Create eToken
ClosedPublic

Authored by kieran709 on Sep 26 2022, 18:40.

Details

Summary

Related to T2593. Removed transformFile prop and related function from Dragger component in CreateTokenForm. According to the error, the component should simply use the beforeUpload prop directly. This related PR (https://github.com/ant-design/ant-design/pull/28365), describes the following: "The original beforeUpload already supports the transformFile capability and removes related documents. This also fixes an issue where the preview function would not use transformFile transformed files."

Test Plan

cd web/cashtab && npm start
navigate to create eToken screen
observe that the error does not fire
drag an image file into the Dragger component
The image should upload.
Drag an unsupported filetype over the Dragger component
A modal should appear instructing user to upload only jpg & png files.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This "works" in that it does appear to resolve the previous error and token creation with icon still functions.

However, it generates a new error, and it's hard to say whether or not the new error is preferable to the old one. It certainly is not as extensively tested.

We get this red error in the filename:

image.png (270×480 px, 42 KB)

Then we also get a persistent POST http://localhost:3000/ 404 (Not Found) in the dev console when an icon is selected.

Need some more research on this issue. See if you can find other users with this same problem, there may be an updated way to use this component.

This revision now requires changes to proceed.Sep 26 2022, 21:06

Responding to review feedback. Found a solution to the new error on SO: https://stackoverflow.com/questions/60414352/next-js-ant-design-dragger-file-upload-fails-on-deployed-instance. Further info about the custom request can be found here: https://github.com/react-component/upload#customrequest. According to the user who posted the solution, "by default, the ANTD upload component makes a POST request to upload the file. So, to avoid this, add a customRequest props on Upload as below."

This revision is now accepted and ready to land.Sep 27 2022, 16:24